Commit 0850401d authored by Viktor De Pasquale's avatar Viktor De Pasquale

Fixed crash where new application asks for root access

parent 337fda20
...@@ -44,7 +44,7 @@ class PolicyDao( ...@@ -44,7 +44,7 @@ class PolicyDao(
condition { condition {
equals("uid", uid) equals("uid", uid)
} }
}.map { it.first().toPolicy(context.packageManager) } }.map { it.firstOrNull()?.toPolicy(context.packageManager) }
.doOnError { .doOnError {
if (it is PackageManager.NameNotFoundException) { if (it is PackageManager.NameNotFoundException) {
delete(uid).subscribe() delete(uid).subscribe()
......
...@@ -110,7 +110,8 @@ class SuRequestViewModel( ...@@ -110,7 +110,8 @@ class SuRequestViewModel(
val bundle = connector.readSocketInput() val bundle = connector.readSocketInput()
val uid = bundle.getString("uid")?.toIntOrNull() ?: return false val uid = bundle.getString("uid")?.toIntOrNull() ?: return false
appRepo.deleteOutdated().blockingGet() // wrong! appRepo.deleteOutdated().blockingGet() // wrong!
policy = appRepo.fetch(uid).blockingGet() ?: uid.toPolicy(packageManager) policy = runCatching { appRepo.fetch(uid).blockingGet() }
.getOrDefault(uid.toPolicy(packageManager))
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
return false return false
......
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