summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-03-24 10:52:33 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2022-03-25 12:02:45 +0100
commitf3a0890845c6be78ebff64a0c511afa26477dff8 (patch)
tree3509fd0f66b1bf4265fe89678f0ba1ff5d84103b /src
parent37fcbbf73b833b90a5567042839371e31fef3e7f (diff)
downloadqtsvg-f3a0890845c6be78ebff64a0c511afa26477dff8.tar.gz
Fix missing null-check in parseBaseGradient()
Of the four functions returned by findStyleFactoryMethod(), two do in fact take care to cope if the first parameter is null; but the other two forward it to parseBaseGradient(), which did not, provoking a warning from CodeChecker. The single caller of parseBaseGradient() is in an if/else cascade in which some branches do assert m_nodes.isEmpty() before passing m_nodes.top() to their respective functions, but the parseBaseGradient() branch did not. I infer that its returns should check for null and duly add the missing null check, rather than asserting against it. Change-Id: I6c630f04522a0ae05021fe95d848be64abe6c20c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/svg/qsvghandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 608adae..ba10271 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2021 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt SVG module of the Qt Toolkit.
@@ -2862,7 +2862,7 @@ static void parseBaseGradient(QSvgNode *node,
QTransform matrix;
QGradient *grad = gradProp->qgradient();
- if (!link.isEmpty()) {
+ if (node && !link.isEmpty()) {
QSvgStyleProperty *prop = node->styleProperty(link);
//qDebug()<<"inherited "<<prop<<" ("<<link<<")";
if (prop && prop->type() == QSvgStyleProperty::GRADIENT) {