Commit 0fe62e25 authored by Mygod's avatar Mygod

Prevent crash when removing current profile

parent 68992ea5
...@@ -195,9 +195,11 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene ...@@ -195,9 +195,11 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
def refreshId(id: Int) { def refreshId(id: Int) {
val index = profiles.indexWhere(_.id == id) val index = profiles.indexWhere(_.id == id)
if (index >= 0) {
profiles(index) = app.profileManager.getProfile(id).get profiles(index) = app.profileManager.getProfile(id).get
notifyItemChanged(index) notifyItemChanged(index)
} }
}
def removeId(id: Int) { def removeId(id: Int) {
val index = profiles.indexWhere(_.id == id) val index = profiles.indexWhere(_.id == id)
profiles.remove(index) profiles.remove(index)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment