[Android] TV: Catch SQLite exception

Geoffrey Métais git at videolan.org
Tue Sep 26 16:35:36 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Sep 26 13:59:56 2017 +0200| [6bf1361fac5a58915eb9b991cb36904538c913ed] | committer: Geoffrey Métais

TV: Catch SQLite exception

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

 .../src/org/videolan/vlc/gui/tv/MainTvActivity.java  | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 76381ccd0..161514201 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -507,16 +507,18 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
             mBrowserAdapter.add(new CardPresenter.SimpleCard(HEADER_DIRECTORIES, directory.getTitle(), R.drawable.ic_menu_folder_big, directory.getUri()));
 
         if (ExternalMonitor.isLan()) {
-            final ArrayList<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
-            mBrowserAdapter.add(new CardPresenter.SimpleCard(HEADER_NETWORK, getString(R.string.network_browsing), R.drawable.ic_menu_network_big));
-            mBrowserAdapter.add(new CardPresenter.SimpleCard(HEADER_STREAM, getString(R.string.open_mrl), R.drawable.ic_menu_stream_big));
-
-            if (!favs.isEmpty()) {
-                for (MediaWrapper fav : favs) {
-                    fav.setDescription(fav.getUri().getScheme());
-                    mBrowserAdapter.add(fav);
+            try {
+                final ArrayList<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
+                mBrowserAdapter.add(new CardPresenter.SimpleCard(HEADER_NETWORK, getString(R.string.network_browsing), R.drawable.ic_menu_network_big));
+                mBrowserAdapter.add(new CardPresenter.SimpleCard(HEADER_STREAM, getString(R.string.open_mrl), R.drawable.ic_menu_stream_big));
+
+                if (!favs.isEmpty()) {
+                    for (MediaWrapper fav : favs) {
+                        fav.setDescription(fav.getUri().getScheme());
+                        mBrowserAdapter.add(fav);
+                    }
                 }
-            }
+            } catch (Exception ignored) {} //SQLite can explode
         }
         mBrowserAdapter.notifyArrayItemRangeChanged(0, mBrowserAdapter.size());
     }



More information about the Android mailing list