Skip to content

Commit

Permalink
Catch NameNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Dec 27, 2015
1 parent 92b9c52 commit 7d44e4f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ import android.net.VpnService
import android.os._
import android.util.Log
import android.widget.Toast
import android.content.pm.PackageManager.NameNotFoundException

import com.github.shadowsocks.aidl.Config
import com.github.shadowsocks.utils._
import org.apache.commons.net.util.SubnetUtils
Expand Down Expand Up @@ -381,10 +383,15 @@ class ShadowsocksVpnService extends VpnService with BaseService {

if (config.isProxyApps) {
for (pkg <- config.proxiedAppString.split('\n')) {
if (!config.isBypassApps) {
builder.addAllowedApplication(pkg)
} else {
builder.addDisallowedApplication(pkg)
try {
if (!config.isBypassApps) {
builder.addAllowedApplication(pkg)
} else {
builder.addDisallowedApplication(pkg)
}
} catch {
case ex: NameNotFoundException =>
Log.e(TAG, "Invalid package name", ex);
}
}
}
Expand Down

0 comments on commit 7d44e4f

Please sign in to comment.