Check for NULL pointer in ApplyStyleCommand
authorCsaba Osztrogonác <ossy@webkit.org>
Fri, 6 Mar 2015 07:33:11 +0000 (07:33 +0000)
committerAlberto Garcia <berto@igalia.com>
Fri, 6 Mar 2015 07:33:11 +0000 (07:33 +0000)
===================================================================

Gbp-Pq: Name nullptr-applystylecommand.patch

Source/WebCore/editing/ApplyStyleCommand.cpp

index 55377c69f58e3c0e09a13f13321f167ed437c07b..e756e95fe77818118922452429c110bb5e06ca23 100644 (file)
@@ -257,6 +257,9 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle *style)
     // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoints.
     // Calculate start and end indices from the start of the tree that they're in.
     Node* scope = highestEditableRoot(visibleStart.deepEquivalent());
+    if (!scope)
+        return;
+
     RefPtr<Range> startRange = Range::create(document(), firstPositionInNode(scope), visibleStart.deepEquivalent().parentAnchoredEquivalent());
     RefPtr<Range> endRange = Range::create(document(), firstPositionInNode(scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent());
     int startIndex = TextIterator::rangeLength(startRange.get(), true);