From 83def1d28830b7d396de1cc522c1d699639d7915 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 7 Aug 2018 13:34:01 +0200 Subject: [PATCH] catch exceptions thrown at storing media in a db --- .../simplemobiletools/gallery/activities/MediaActivity.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 28cea3331..3fb257835 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -824,7 +824,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { mLatestMediaDateId = getLatestMediaByDateId() if (!isFromCache) { val mediaToInsert = (mMedia).filter { it is Medium && it.deletedTS == 0L }.map { it as Medium } - mMediumDao.insertAll(mediaToInsert) + try { + mMediumDao.insertAll(mediaToInsert) + } catch (e: Exception) { + } } }