Skip to content

Commit 6c381b0

Browse files
committed
Fix a crash reported by Goolge Play
1 parent e3f0fa6 commit 6c381b0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Diff for: src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala

+16-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,22 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
207207
}
208208

209209
def refreshProfile() {
210-
profile = app.currentProfile.get
210+
val profile = app.currentProfile match {
211+
case Some(profile) => profile
212+
case None => {
213+
app.profileManager.getFirstProfile match {
214+
case Some(profile) => {
215+
app.profileId(profile.id)
216+
profile
217+
}
218+
case None => {
219+
val default = app.profileManager.createDefault()
220+
app.profileId(default.id)
221+
default
222+
}
223+
}
224+
}
225+
}
211226
isProxyApps.setChecked(profile.proxyApps)
212227
}
213228

0 commit comments

Comments
 (0)