diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-02-25 16:58:27 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-03-04 05:49:56 +0000 |
commit | c72c22871774261ad980eb5a7e0c786ee44a5a4d (patch) | |
tree | 9460500dbf210f277d6ca36377849d651321142b /src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp | |
parent | 0f269e24949a1828bd8896c97e87c0bd4ad38532 (diff) |
Add nullptr checks to QGraphicsView classes
The styleInfo parameter defaults to nullptr, and the scene can evidently
be nullptr since we test for it before ungrabbing the mouse.
Fixes static analyzer warnings
fbd03604cc701651595a2ea33c5562b4 and
30fcb05194f3a2d121fc57b05e0ccf10
Change-Id: I8e9d4fe4055115c366ada1cbb22a8f0839ba41da
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 98db99657649d4668c766eaa36b8d29c58d19754)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp index be26b2785e..9da290974b 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp @@ -225,7 +225,7 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo) if (anchorPrivate->hasSize) { // Anchor has user-defined size prefSizeHint = anchorPrivate->preferredSize; - } else { + } else if (styleInfo) { // Fetch size information from style const Qt::Orientation orient = QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge); qreal s = styleInfo->defaultSpacing(orient); @@ -241,6 +241,8 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo) s = 0; } prefSizeHint = s; + } else { + prefSizeHint = 0; } } |