REGRESSION (r175376): Occasional null deref when doing a dictionary lookup
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Oct 2014 21:49:44 +0000 (21:49 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Oct 2014 21:49:44 +0000 (21:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138261
<rdar://problem/18841709>

Reviewed by Anders Carlsson.

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performDictionaryLookupAtLocation):
rangeForDictionaryLookupAtHitTestResult can easily return null.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175428 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

index 93a6338f949bfc3ad9b50a45b647c97aa5622885..890e6f9273358d52553f209222d9f3d5d1f985b8 100644 (file)
@@ -1,3 +1,15 @@
+2014-10-31  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r175376): Occasional null deref when doing a dictionary lookup
+        https://bugs.webkit.org/show_bug.cgi?id=138261
+        <rdar://problem/18841709>
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::performDictionaryLookupAtLocation):
+        rangeForDictionaryLookupAtHitTestResult can easily return null.
+
 2014-10-31  Beth Dakin  <bdakin@apple.com>
 
         Use system art for action menus when possible
index 259353f4a2c16943c44db27608fbc5af323613ff..2e02e81a09c845f9454012144bcaa6eb0a8c9c98 100644 (file)
@@ -576,6 +576,9 @@ void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
     Frame* frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document().frame() : &m_page->focusController().focusedOrMainFrame();
     NSDictionary *options = nil;
     RefPtr<Range> range = rangeForDictionaryLookupAtHitTestResult(result, &options);
+    if (!range)
+        return;
+
     performDictionaryLookupForRange(frame, *range, options);
 }