Commit 63569a44 authored by Max Lv's avatar Max Lv

fix a crash when upgrading database

parent 10234542
......@@ -54,9 +54,11 @@ object DBHelper {
final val PROFILE = "profile.db"
private var apps: mutable.Buffer[ApplicationInfo] = _
def isAllDigits(x: String) = !x.isEmpty && (x forall Character.isDigit)
def updateProxiedApps(context: Context, old: String) = {
synchronized(if (apps == null) apps = context.getPackageManager.getInstalledApplications(0).asScala)
val uidSet = old.split('|').map(_.toInt).toSet
val uidSet = old.split('|').filter(isAllDigits).map(_.toInt).toSet
apps.filter(ai => uidSet.contains(ai.uid)).map(_.packageName).mkString("\n")
}
}
......
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