[Android] Fix NumberFormatException

Nicolas Pomepuy git at videolan.org
Tue Oct 1 14:44:30 CEST 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Thu Sep 26 07:16:33 2019 +0200| [47b9b707333fbf93df9847d6ddf3bd404769c5f1] | committer: Geoffrey Métais

Fix NumberFormatException

(cherry picked from commit c0b78834b77325776233150e07bce6b780bb9c2e)

> https://code.videolan.org/videolan/vlc-android/commit/47b9b707333fbf93df9847d6ddf3bd404769c5f1
---

 vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
index cad6fbe50..c64958f8a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesUi.kt
@@ -129,7 +129,12 @@ class PreferencesUi : BasePreferenceFragment(), SharedPreferences.OnSharedPrefer
                 (activity as PreferencesActivity).setRestart()
             }
             "video_group_size" -> {
-                AbstractMedialibrary.getInstance().setVideoGroupsPrefixLength(Settings.getInstance(requireActivity()).getString(key, "6").toInt())
+                val goupSizeValue = try {
+                    Settings.getInstance(requireActivity()).getString(key, "6").toInt()
+                } catch (e: NumberFormatException) {
+                    6
+                }
+                AbstractMedialibrary.getInstance().setVideoGroupsPrefixLength(goupSizeValue)
                 (activity as PreferencesActivity).setRestart()
             }
         }



More information about the Android mailing list