[Android] Prevent NPE if activity is null
Geoffrey Métais
git at videolan.org
Tue Mar 31 17:16:15 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 31 17:15:09 2015 +0200| [d37c0c3a5715b77ca436c8c4ec9a6aded9e3af02] | committer: Geoffrey Métais
Prevent NPE if activity is null
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d37c0c3a5715b77ca436c8c4ec9a6aded9e3af02
---
vlc-android/src/org/videolan/vlc/gui/network/NetworkFragment.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/network/NetworkFragment.java b/vlc-android/src/org/videolan/vlc/gui/network/NetworkFragment.java
index 0d73deb..9562bd4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/network/NetworkFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/network/NetworkFragment.java
@@ -330,9 +330,10 @@ public class NetworkFragment extends BrowserFragment implements IRefreshable, Me
};
private void focusHelper(boolean idIsEmpty) {
- View parent = View.inflate(getActivity(),
- R.layout.directory_view, null);
+ if (getActivity() == null)
+ return;
MainActivity main = (MainActivity)getActivity();
+ View parent = View.inflate(main, R.layout.directory_view, null);
main.setMenuFocusDown(idIsEmpty, R.id.network_list);
main.setSearchAsFocusDown(idIsEmpty, parent, R.id.network_list);
}
More information about the Android
mailing list