Bug 1387608 - Check if tempPosition is null in pivot move by text. r=surkov
authorEitan Isaacson <eitan@monotonous.org>
Thu, 22 Mar 2018 15:10:00 -0400
changeset 409954 6c26d163c132
parent 409953 330dc2385e33
child 409955 72815b4da101
push id101367
push userryanvm@gmail.com
push dateMon, 26 Mar 2018 19:19:37 +0000
treeherdermozilla-inbound@6c26d163c132 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1387608
milestone61.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 1387608 - Check if tempPosition is null in pivot move by text. r=surkov
accessible/base/nsAccessiblePivot.cpp
--- a/accessible/base/nsAccessiblePivot.cpp
+++ b/accessible/base/nsAccessiblePivot.cpp
@@ -312,16 +312,17 @@ nsAccessiblePivot::MoveNextByText(TextBo
   NS_ENSURE_ARG(aResult);
 
   *aResult = false;
 
   int32_t tempStart = mStartOffset, tempEnd = mEndOffset;
   Accessible* tempPosition = mPosition;
   Accessible* root = GetActiveRoot();
   while (true) {
+    NS_ENSURE_TRUE(tempPosition, NS_ERROR_UNEXPECTED);
     Accessible* curPosition = tempPosition;
     HyperTextAccessible* text = nullptr;
     // Find the nearest text node using a preorder traversal starting from
     // the current node.
     if (!(text = tempPosition->AsHyperText())) {
       text = SearchForText(tempPosition, false);
       if (!text)
         return NS_OK;
@@ -431,16 +432,17 @@ nsAccessiblePivot::MovePreviousByText(Te
   NS_ENSURE_ARG(aResult);
 
   *aResult = false;
 
   int32_t tempStart = mStartOffset, tempEnd = mEndOffset;
   Accessible* tempPosition = mPosition;
   Accessible* root = GetActiveRoot();
   while (true) {
+    NS_ENSURE_TRUE(tempPosition, NS_ERROR_UNEXPECTED);
     Accessible* curPosition = tempPosition;
     HyperTextAccessible* text;
     // Find the nearest text node using a reverse preorder traversal starting
     // from the current node.
     if (!(text = tempPosition->AsHyperText())) {
       text = SearchForText(tempPosition, true);
       if (!text)
         return NS_OK;