[Content Filtering] Crash when allowing a 0-byte resource to load
[WebKit-https.git] / Source / WebCore / loader / ContentFilter.cpp
index 25d70ee29d2af37b0e36e2f0290f978bbea64214..2f600cb816b4f46d662efa745bc37c83f9a1750b 100644 (file)
@@ -259,8 +259,8 @@ void ContentFilter::didDecide(State state)
 void ContentFilter::deliverResourceData(CachedResource& resource)
 {
     ASSERT(resource.dataBufferingPolicy() == BufferData);
-    const SharedBuffer& resourceBuffer = *resource.resourceBuffer();
-    m_documentLoader.dataReceived(&resource, resourceBuffer.data(), resourceBuffer.size());
+    if (auto* resourceBuffer = resource.resourceBuffer())
+        m_documentLoader.dataReceived(&resource, resourceBuffer->data(), resourceBuffer->size());
 }
 
 } // namespace WebCore