aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-12-03 16:23:24 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2019-12-05 11:23:52 +0100
commit290251541e615358dcc7a289ff2adb30f309c132 (patch)
tree4ce2d7839a7633839d93c43ba7b8ca5b2d7c47d9 /src/quick
parent75c7f093e0b8e321306ae1189b71866a9073df00 (diff)
QQuickPixmapCache: Don't dereference nullptrv5.14.0-rc2v5.14.0
Consistently check that job->data is not null before derefencing it. Fixes: QTBUG-80510 Fixes: QTBUG-79937 Change-Id: I894503ddd2254814463073cc12f8365641efc689 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/util/qquickpixmapcache.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 56ad8ebf0b..e1b30f2b2c 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -567,9 +567,10 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply)
QBuffer buff(&all);
buff.open(QIODevice::ReadOnly);
int frameCount;
- if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, &frameCount, job->requestSize, job->providerOptions, nullptr, job->data->frame))
+ int const frame = job->data ? job->data->frame : 0;
+ if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, &frameCount, job->requestSize, job->providerOptions, nullptr, frame))
error = QQuickPixmapReply::Decoding;
- else
+ else if (job->data)
job->data->frameCount = frameCount;
}
// send completion event to the QQuickPixmapReply
@@ -882,7 +883,8 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u
return;
} else {
int frameCount;
- if (!readImage(url, &f, &image, &errorStr, &readSize, &frameCount, runningJob->requestSize, runningJob->providerOptions, nullptr, runningJob->data->frame)) {
+ int const frame = runningJob->data ? runningJob->data->frame : 0;
+ if ( !readImage(url, &f, &image, &errorStr, &readSize, &frameCount, runningJob->requestSize, runningJob->providerOptions, nullptr, frame)) {
errorCode = QQuickPixmapReply::Loading;
if (f.fileName() != localFile)
errorStr += QString::fromLatin1(" (%1)").arg(f.fileName());