From 6fb7330e368dd399bac2dc3646a4068dc9e4ab78 Mon Sep 17 00:00:00 2001 From: Mygod Date: Mon, 23 Jan 2017 03:42:59 +0800 Subject: [PATCH] Fix crash on unknown plugin --- .../github/shadowsocks/preference/IconListPreference.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/scala/com/github/shadowsocks/preference/IconListPreference.scala b/mobile/src/main/scala/com/github/shadowsocks/preference/IconListPreference.scala index 23301b2f..86591147 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/preference/IconListPreference.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/preference/IconListPreference.scala @@ -41,7 +41,9 @@ class IconListPreference(context: Context, attrs: AttributeSet = null) extends L // a.recycle() // } - def getEntryIcon: Drawable = mEntryIcons(selectedEntry) + def getEntryIcon: Drawable = try mEntryIcons(selectedEntry) catch { + case _: ArrayIndexOutOfBoundsException => null + } def getEntryIcons: Array[Drawable] = mEntryIcons def setEntryIcons(entryIcons: Array[Drawable]): Unit = mEntryIcons = entryIcons