Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1356)

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 215773002: Don't call RenderObject::enclosingLayer on a null pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index 31a847fe366c0a530aead2289ed17e7cf67fc4d6..d41640796a782dc3a601a73d5a4b1f7def042229 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -529,10 +529,8 @@ RenderLayer* RenderObject::enclosingLayer() const
if (current->hasLayer())
return toRenderLayerModelObject(current)->layer();
}
- // This line of code should be unreachable. However, if |this| is zero, we
- // can reach this line. Of course, it's undefined behavior to call a member
- // function on a zero pointer, but that doesn't stop
- // FrameView::paintContents. :)
+ // This function can return zero only for RenderObjects that have not yet been added to the tree.
+ ASSERT(!m_parent && !isRenderView());
esprehn 2014/03/27 23:54:28 I'd ASSERT(isRooted()) at the top and ASSERT_NOT_R
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698