Commit 7d44e4fc authored by Max Lv's avatar Max Lv

Catch NameNotFoundException

parent 92b9c529
...@@ -49,6 +49,8 @@ import android.net.VpnService ...@@ -49,6 +49,8 @@ import android.net.VpnService
import android.os._ import android.os._
import android.util.Log import android.util.Log
import android.widget.Toast import android.widget.Toast
import android.content.pm.PackageManager.NameNotFoundException
import com.github.shadowsocks.aidl.Config import com.github.shadowsocks.aidl.Config
import com.github.shadowsocks.utils._ import com.github.shadowsocks.utils._
import org.apache.commons.net.util.SubnetUtils import org.apache.commons.net.util.SubnetUtils
...@@ -381,11 +383,16 @@ class ShadowsocksVpnService extends VpnService with BaseService { ...@@ -381,11 +383,16 @@ class ShadowsocksVpnService extends VpnService with BaseService {
if (config.isProxyApps) { if (config.isProxyApps) {
for (pkg <- config.proxiedAppString.split('\n')) { for (pkg <- config.proxiedAppString.split('\n')) {
try {
if (!config.isBypassApps) { if (!config.isBypassApps) {
builder.addAllowedApplication(pkg) builder.addAllowedApplication(pkg)
} else { } else {
builder.addDisallowedApplication(pkg) builder.addDisallowedApplication(pkg)
} }
} catch {
case ex: NameNotFoundException =>
Log.e(TAG, "Invalid package name", ex);
}
} }
} }
} }
......
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