Merge "Fix crash when input illegal proxy port number" am: e8160af796
am: 6372ae5e93
am: ab0dc7b129
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2255620 Change-Id: Ia9db49f176a65bb2d512cd7e0694284f03414a82 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -626,7 +626,14 @@ class ConfigDialog extends AlertDialog implements TextWatcher,
|
|||||||
String proxyPort = mProxyPort.getText().toString().trim();
|
String proxyPort = mProxyPort.getText().toString().trim();
|
||||||
// 0 is a last resort default, but the interface validates that the proxy port is
|
// 0 is a last resort default, but the interface validates that the proxy port is
|
||||||
// present and non-zero.
|
// present and non-zero.
|
||||||
int port = proxyPort.isEmpty() ? 0 : Integer.parseInt(proxyPort);
|
int port = 0;
|
||||||
|
if (!proxyPort.isEmpty()) {
|
||||||
|
try {
|
||||||
|
port = Integer.parseInt(proxyPort);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.e(TAG, "Could not parse proxy port integer ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
profile.proxy = ProxyInfo.buildDirectProxy(proxyHost, port);
|
profile.proxy = ProxyInfo.buildDirectProxy(proxyHost, port);
|
||||||
} else {
|
} else {
|
||||||
profile.proxy = null;
|
profile.proxy = null;
|
||||||
|
Reference in New Issue
Block a user