srctree

Robin Linden parent a1dc7c90 bbae3c77
Simplify code flow to make static code analysis happier

Static code analysis was complaining about this function alwaysreturning ToxSaveStatus.SaveNotFound, which obviously isn't true.

inlinesplit
atox/src/main/kotlin/tox/ToxStarter.kt added: 6, removed: 8, total 0
@@ -64,14 +64,12 @@ class ToxStarter @Inject constructor(
}
 
fun tryLoadTox(password: String?): ToxSaveStatus {
tryLoadSave()?.also { save ->
val status = startTox(save, password)
if (status == ToxSaveStatus.Ok) {
userManager.verifyExists(tox.publicKey)
}
return status
val save = tryLoadSave() ?: return ToxSaveStatus.SaveNotFound
val status = startTox(save, password)
if (status == ToxSaveStatus.Ok) {
userManager.verifyExists(tox.publicKey)
}
return ToxSaveStatus.SaveNotFound
return status
}
 
private fun startService() = context.run {