Index: third_party/WebKit/Source/core/frame/VisualViewport.cpp |
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp |
index 4acde963848833fb9315a0602ede962ac9cee9a4..ae02f2f064a914fc292389186f955c8e681a4fb3 100644 |
--- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp |
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp |
@@ -195,6 +195,9 @@ void VisualViewport::setScale(float scale) |
void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location) |
{ |
+ if (!mainFrame()) |
+ return; |
+ |
bool valuesChanged = false; |
if (scale != m_scale) { |
@@ -213,8 +216,8 @@ void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location |
if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordinator()) |
coordinator->scrollableAreaScrollLayerDidChange(this); |
- Document* document = mainFrame()->document(); |
- document->enqueueScrollEventForNode(document); |
+ if (Document* document = mainFrame()->document()) |
+ document->enqueueScrollEventForNode(document); |
mainFrame()->loader().client()->didChangeScrollOffset(); |
valuesChanged = true; |