Bug 1425030: ia2Accessible::get_accessibleWithCaret: Gracefully handle null returned from SelectionManager::AccessibleWithCaret. r=surkov a=ritu
authorJames Teh <jteh@mozilla.com>
Tue, 12 Dec 2017 13:38:34 +1000
changeset 445353 e1b8647ff08e1b9529d146efb2134c6171c4cdae
parent 445352 734cd1dab1a3f0d845a9e9e6c40ac575548a4b41
child 445354 53df9fbc528e56deb67566e7e02f4441291cfd77
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, ritu
bugs1425030
milestone58.0
Bug 1425030: ia2Accessible::get_accessibleWithCaret: Gracefully handle null returned from SelectionManager::AccessibleWithCaret. r=surkov a=ritu We weren't checking for null previously, thus causing a crash when there was no caret. MozReview-Commit-ID: 6NNRafcVPhb
accessible/windows/ia2/ia2Accessible.cpp
--- a/accessible/windows/ia2/ia2Accessible.cpp
+++ b/accessible/windows/ia2/ia2Accessible.cpp
@@ -517,17 +517,17 @@ ia2Accessible::get_accessibleWithCaret(I
   *aCaretOffset = -1;
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   int32_t caretOffset = -1;
   Accessible* accWithCaret = SelectionMgr()->AccessibleWithCaret(&caretOffset);
-  if (acc->Document() != accWithCaret->Document())
+  if (!accWithCaret || acc->Document() != accWithCaret->Document())
     return S_FALSE;
 
   Accessible* child = accWithCaret;
   while (!child->IsDoc() && child != acc)
     child = child->Parent();
 
   if (child != acc)
     return S_FALSE;