[Android] Prevent NPE

Geoffrey Métais git at videolan.org
Fri Aug 19 16:46:59 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug 19 16:45:30 2016 +0200| [7fa415eb9dd5e62d42f9912ce645290288a9c4fb] | committer: Geoffrey Métais

Prevent NPE

(cherry picked from commit dbd7e56c42b1528f4dd82f627fdacc7fac51c28b)

> https://code.videolan.org/videolan/vlc-android/commit/7fa415eb9dd5e62d42f9912ce645290288a9c4fb
---

 vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.java b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.java
index 3a4d6ca..e9e3da6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.java
@@ -89,13 +89,14 @@ public class MRLPanelFragment extends Fragment implements IHistory, View.OnKeyLi
     @Override
     public void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
-        outState.putString(KEY_MRL, mEditText.getEditText().getText().toString());
+        if (mEditText != null)
+            outState.putString(KEY_MRL, mEditText.getEditText().getText().toString());
     }
 
     @Override
     public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
         super.onViewStateRestored(savedInstanceState);
-        if (savedInstanceState == null)
+        if (savedInstanceState == null || mEditText == null)
             return;
         String mrl = savedInstanceState.getString(KEY_MRL);
         mEditText.getEditText().setText(mrl);



More information about the Android mailing list