fix a crash when upgrading database
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user