[MediaWiki-commits] [Gerrit] Fix possible NPE in Nearby - change (apps...wikipedia)

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

Change subject: Fix possible NPE in Nearby
..


Fix possible NPE in Nearby

When coming back to app or rotating.

java.lang.NullPointerException
at 
org.wikipedia.nearby.NearbyFragment.onCreateOptionsMenu(NearbyFragment.java:496)

Change-Id: Ie1d5dcf488056036ab836e34d696d39afa2f21d1
---
M wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java 
b/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
index a77e780..8be5418 100644
--- a/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
+++ b/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
@@ -493,7 +493,7 @@
 
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-if (((PageActivity)getActivity()).isSearching()) {
+if (!isAdded() || ((PageActivity)getActivity()).isSearching()) {
 return;
 }
 inflater.inflate(R.menu.menu_nearby, menu);
@@ -506,7 +506,7 @@
 @Override
 public void onPrepareOptionsMenu(Menu menu) {
 super.onPrepareOptionsMenu(menu);
-if (((PageActivity)getActivity()).isSearching()) {
+if (!isAdded() || ((PageActivity)getActivity()).isSearching()) {
 return;
 }
 menu.findItem(R.id.menu_refresh_nearby).setEnabled(!refreshing);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1d5dcf488056036ab836e34d696d39afa2f21d1
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Dbrant 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] Fix possible NPE in Nearby - change (apps...wikipedia)

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

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

Change subject: Fix possible NPE in Nearby
..

Fix possible NPE in Nearby

When coming back to app or rotating.

java.lang.NullPointerException
at 
org.wikipedia.nearby.NearbyFragment.onCreateOptionsMenu(NearbyFragment.java:496)

Change-Id: Ie1d5dcf488056036ab836e34d696d39afa2f21d1
---
M wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java 
b/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
index a77e780..8be5418 100644
--- a/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
+++ b/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
@@ -493,7 +493,7 @@
 
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-if (((PageActivity)getActivity()).isSearching()) {
+if (!isAdded() || ((PageActivity)getActivity()).isSearching()) {
 return;
 }
 inflater.inflate(R.menu.menu_nearby, menu);
@@ -506,7 +506,7 @@
 @Override
 public void onPrepareOptionsMenu(Menu menu) {
 super.onPrepareOptionsMenu(menu);
-if (((PageActivity)getActivity()).isSearching()) {
+if (!isAdded() || ((PageActivity)getActivity()).isSearching()) {
 return;
 }
 menu.findItem(R.id.menu_refresh_nearby).setEnabled(!refreshing);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1d5dcf488056036ab836e34d696d39afa2f21d1
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND 

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