Bug 1425030: ia2Accessible::get_accessibleWithCaret: Gracefully handle null returned from SelectionManager::AccessibleWithCaret. r=surkov
authorJames Teh <jteh@mozilla.com>
Tue, 12 Dec 2017 13:38:34 +1000
changeset 396391 979ceb379e0b2eebaa01514b24fbb7418e6b2747
parent 396390 70eb26bf87605ed49e36e4c193801ac89e477936
child 396392 bbe4d2292f86e4f3994f11496f1850f2851a2b63
push id56977
push userjteh@mozilla.com
push dateThu, 14 Dec 2017 12:23:33 +0000
treeherderautoland@979ceb379e0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1425030
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1425030: ia2Accessible::get_accessibleWithCaret: Gracefully handle null returned from SelectionManager::AccessibleWithCaret. r=surkov 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;