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,10 +383,15 @@ class ShadowsocksVpnService extends VpnService with BaseService { ...@@ -381,10 +383,15 @@ class ShadowsocksVpnService extends VpnService with BaseService {
if (config.isProxyApps) { if (config.isProxyApps) {
for (pkg <- config.proxiedAppString.split('\n')) { for (pkg <- config.proxiedAppString.split('\n')) {
if (!config.isBypassApps) { try {
builder.addAllowedApplication(pkg) if (!config.isBypassApps) {
} else { builder.addAllowedApplication(pkg)
builder.addDisallowedApplication(pkg) } else {
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