[Android] Prevent IllegalStateException on delete fail

Geoffrey Métais git at videolan.org
Tue Jan 9 15:36:53 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan  9 09:49:36 2018 +0100| [6ad0a79d8c7f116d8ca5f55721220396c292e9b7] | committer: Geoffrey Métais

Prevent IllegalStateException on delete fail

> https://code.videolan.org/videolan/vlc-android/commit/6ad0a79d8c7f116d8ca5f55721220396c292e9b7
---

 .../src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
index c3735c646..35224bb0a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
@@ -208,11 +208,11 @@ public abstract class MediaBrowserFragment extends PlaybackServiceFragment imple
     }
 
     private void onDeleteFailed(MediaWrapper media) {
-        UiTools.snacker(getView(), getString(R.string.msg_delete_failed, media.getTitle()));
+        if (isAdded()) UiTools.snacker(getView(), getString(R.string.msg_delete_failed, media.getTitle()));
     }
 
     protected void showInfoDialog(MediaLibraryItem item) {
-        Intent i = new Intent(getActivity(), InfoActivity.class);
+        final Intent i = new Intent(getActivity(), InfoActivity.class);
         i.putExtra(InfoActivity.TAG_ITEM, item);
         startActivity(i);
     }



More information about the Android mailing list