[MediaWiki-commits] [Gerrit] Avoid NPE calling updateProgressBar - change (apps...wikipedia)

2014-12-09 Thread Dbrant (Code Review)
Dbrant has submitted this change and it was merged.

Change subject: Avoid NPE calling updateProgressBar
..


Avoid NPE calling updateProgressBar

plus in some more callbacks.

Got this myself with recent alpha bits:
java.lang.NullPointerException: Attempt to invoke virtual method 'void 
org.wikipedia.page.PageActivity.updateProgressBar(boolean, boolean, int)' on a 
null object reference
at 
org.wikipedia.page.PageViewFragmentInternal.performActionForState(PageViewFragmentInternal.java:520)
at 
org.wikipedia.page.PageViewFragmentInternal.access$1100(PageViewFragmentInternal.java:76)
at 
org.wikipedia.page.PageViewFragmentInternal$5$1.run(PageViewFragmentInternal.java:405)
at org.wikipedia.ViewAnimations$2.onAnimationEnd(ViewAnimations.java:127)
at 
com.nineoldandroids.view.ViewPropertyAnimatorICS$1.onAnimationEnd(ViewPropertyAnimatorICS.java:90)
at 
android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1116)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1089)
at 
android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:666)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:682)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:549)
at 
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Change-Id: Ia22b82c9e0698ca42e3f67f07f0c6467d9f552a7
---
M wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
1 file changed, 9 insertions(+), 0 deletions(-)

Approvals:
  Dbrant: Looks good to me, approved
  jenkins-bot: Verified



diff --git 
a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java 
b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
index 522c86b..50dc6a6 100644
--- a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
+++ b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
@@ -515,6 +515,9 @@
 }
 
 private void performActionForState(int forState) {
+if (!isAdded()) {
+return;
+}
 switch (forState) {
 case STATE_NO_FETCH:
 getActivity().updateProgressBar(true, true, 0);
@@ -538,6 +541,9 @@
 leadImagesHandler.beginLayout(new 
LeadImagesHandler.OnLeadImageLayoutListener() {
 @Override
 public void onLayoutComplete() {
+if (!isAdded()) {
+return;
+}
 // when the lead image layout is complete, load the 
lead section and
 // the other sections into the webview.
 displayLeadSection();
@@ -943,6 +949,9 @@
 leadImagesHandler.beginLayout(new 
LeadImagesHandler.OnLeadImageLayoutListener() {
 @Override
 public void onLayoutComplete() {
+if (!isAdded()) {
+return;
+}
 // when the lead image is laid out, load the lead 
section and the rest
 // of the sections into the webview.
 displayLeadSection();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia22b82c9e0698ca42e3f67f07f0c6467d9f552a7
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND bsitzm...@wikimedia.org
Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org
Gerrit-Reviewer: Dbrant dbr...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

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


[MediaWiki-commits] [Gerrit] Avoid NPE calling updateProgressBar - change (apps...wikipedia)

2014-12-08 Thread BearND (Code Review)
BearND has uploaded a new change for review.

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

Change subject: Avoid NPE calling updateProgressBar
..

Avoid NPE calling updateProgressBar

plus in some more callbacks.

Got this myself with recent alpha bits:
java.lang.NullPointerException: Attempt to invoke virtual method 'void 
org.wikipedia.page.PageActivity.updateProgressBar(boolean, boolean, int)' on a 
null object reference
at 
org.wikipedia.page.PageViewFragmentInternal.performActionForState(PageViewFragmentInternal.java:520)
at 
org.wikipedia.page.PageViewFragmentInternal.access$1100(PageViewFragmentInternal.java:76)
at 
org.wikipedia.page.PageViewFragmentInternal$5$1.run(PageViewFragmentInternal.java:405)
at org.wikipedia.ViewAnimations$2.onAnimationEnd(ViewAnimations.java:127)
at 
com.nineoldandroids.view.ViewPropertyAnimatorICS$1.onAnimationEnd(ViewPropertyAnimatorICS.java:90)
at 
android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1116)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1089)
at 
android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:666)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:682)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:549)
at 
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Change-Id: Ia22b82c9e0698ca42e3f67f07f0c6467d9f552a7
---
M wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
1 file changed, 9 insertions(+), 0 deletions(-)


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

diff --git 
a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java 
b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
index 522c86b..50dc6a6 100644
--- a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
+++ b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java
@@ -515,6 +515,9 @@
 }
 
 private void performActionForState(int forState) {
+if (!isAdded()) {
+return;
+}
 switch (forState) {
 case STATE_NO_FETCH:
 getActivity().updateProgressBar(true, true, 0);
@@ -538,6 +541,9 @@
 leadImagesHandler.beginLayout(new 
LeadImagesHandler.OnLeadImageLayoutListener() {
 @Override
 public void onLayoutComplete() {
+if (!isAdded()) {
+return;
+}
 // when the lead image layout is complete, load the 
lead section and
 // the other sections into the webview.
 displayLeadSection();
@@ -943,6 +949,9 @@
 leadImagesHandler.beginLayout(new 
LeadImagesHandler.OnLeadImageLayoutListener() {
 @Override
 public void onLayoutComplete() {
+if (!isAdded()) {
+return;
+}
 // when the lead image is laid out, load the lead 
section and the rest
 // of the sections into the webview.
 displayLeadSection();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia22b82c9e0698ca42e3f67f07f0c6467d9f552a7
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