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 410062 6c26d163c132
parent 410061 330dc2385e33
child 410063 72815b4da101
push id33717
push userbtara@mozilla.com
push dateTue, 27 Mar 2018 09:13:26 +0000
treeherdermozilla-central@40ef480efa7a [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;