aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2024-09-02 20:27:33 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2024-09-06 20:30:19 +0200
commita06e7f21af85a8e918240b28691f5c70947bdc5d (patch)
tree15d6645080451d3c3d1a735c6aec568de0fb888f
parentd824585075b0abaec12c0cbb6445aa4eb84b2cea (diff)
VectorImage: Fix potential nullptr dereference
The lout pointer was dereferenced right before it was tested for being null. This modifies c25bfd53425894ff12f3f883f3d6c211e9840973 Coverity-Id: 467163 Pick-to: 6.8 Change-Id: I2ebbc2c321971997f8553c8dfcb3f235ffff044c Reviewed-by: Robert Löhning <robert.loehning@qt.io>
-rw-r--r--src/quickvectorimage/generator/qsvgvisitorimpl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quickvectorimage/generator/qsvgvisitorimpl.cpp b/src/quickvectorimage/generator/qsvgvisitorimpl.cpp
index 427d31715a..9a9b391661 100644
--- a/src/quickvectorimage/generator/qsvgvisitorimpl.cpp
+++ b/src/quickvectorimage/generator/qsvgvisitorimpl.cpp
@@ -786,9 +786,10 @@ void QSvgVisitorImpl::visitTextNode(const QSvgText *node)
QTextBlock block = document.firstBlock();
while (block.isValid()) {
QTextLayout *lout = block.layout();
- QRectF boundingRect = lout->boundingRect();
if (lout != nullptr) {
+ QRectF boundingRect = lout->boundingRect();
+
// If this block has requested the current SVG font, we override it
// (note that this limits the text to one svg font, but this is also the case
// in the QPainter at the moment, and needs a more centralized solution in Qt Svg