BearND has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/221970

Change subject: Avoid NPE in JsonPageLoadStrategy.onSaveInstanceState
......................................................................

Avoid NPE in JsonPageLoadStrategy.onSaveInstanceState

This cannot be easily reproduced but according to the stack trace this happens
when backStack == null during onSaveInstanceState.

Bug: T104090
Change-Id: Ib359cce9a508f3d9640af5ae23c38aecf923d17a
---
M wikipedia/src/main/java/org/wikipedia/page/JsonPageLoadStrategy.java
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/70/221970/1

diff --git 
a/wikipedia/src/main/java/org/wikipedia/page/JsonPageLoadStrategy.java 
b/wikipedia/src/main/java/org/wikipedia/page/JsonPageLoadStrategy.java
index fa8fae9..e559519 100644
--- a/wikipedia/src/main/java/org/wikipedia/page/JsonPageLoadStrategy.java
+++ b/wikipedia/src/main/java/org/wikipedia/page/JsonPageLoadStrategy.java
@@ -211,9 +211,11 @@
 
     @Override
     public void onSaveInstanceState(Bundle outState) {
-        // update the topmost entry in the backstack
-        updateCurrentBackStackItem();
-        outState.putParcelableArrayList("backStack", backStack);
+        if (backStack != null) {
+            // update the topmost entry in the backstack
+            updateCurrentBackStackItem();
+            outState.putParcelableArrayList("backStack", backStack);
+        }
     }
 
     @Override
@@ -478,7 +480,7 @@
      * Does NOT automatically load the next topmost page on the backstack.
      */
     private void popBackStack() {
-        if (backStack.size() == 0) {
+        if (backStack.isEmpty()) {
             return;
         }
         backStack.remove(backStack.size() - 1);

-- 
To view, visit https://gerrit.wikimedia.org/r/221970
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib359cce9a508f3d9640af5ae23c38aecf923d17a
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND <bsitzm...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to