From f3a0890845c6be78ebff64a0c511afa26477dff8 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 24 Mar 2022 10:52:33 +0100 Subject: 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 --- src/svg/qsvghandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 "<type() == QSvgStyleProperty::GRADIENT) { -- cgit v1.2.1