summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@theqtcompany.com>2015-04-21 10:53:27 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-04-21 09:45:16 +0000
commit2ac19ee6bb5732a3a585b8d9378bc65107748a36 (patch)
tree5a2503fee89317a44ce1985c0b8c0ab694b96acc
parent738ad7e37c66f2afdbc7a77aff3ab7fa510361a2 (diff)
Fix crash when loading new doc after a single image doc
Added a couple of nullpointer checks in image document cleanup. Task-number: QTBUG-42890 Change-Id: I533a517ed7402428afc3ae470398a64ed0b6a2a8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
-rw-r--r--Source/WebCore/html/ImageDocument.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/WebCore/html/ImageDocument.cpp b/Source/WebCore/html/ImageDocument.cpp
index 7d9bcc589..594ccad90 100644
--- a/Source/WebCore/html/ImageDocument.cpp
+++ b/Source/WebCore/html/ImageDocument.cpp
@@ -135,6 +135,8 @@ void ImageDocumentParser::appendBytes(DocumentWriter*, const char*, size_t)
return;
CachedImage* cachedImage = document()->cachedImage();
+ if (!cachedImage)
+ return;
RefPtr<ResourceBuffer> resourceData = frame->loader()->documentLoader()->mainResourceData();
cachedImage->addDataBuffer(resourceData.get());
@@ -143,8 +145,8 @@ void ImageDocumentParser::appendBytes(DocumentWriter*, const char*, size_t)
void ImageDocumentParser::finish()
{
- if (!isStopped() && document()->imageElement()) {
- CachedImage* cachedImage = document()->cachedImage();
+ CachedImage* cachedImage = 0;
+ if (!isStopped() && document()->imageElement() && (cachedImage = document()->cachedImage())) {
RefPtr<ResourceBuffer> data = document()->frame()->loader()->documentLoader()->mainResourceData();
// If this is a multipart image, make a copy of the current part, since the resource data