Skip to content

Commit 94bc36e

Browse files
committed
fix:修复一个crash问题
1 parent 7639967 commit 94bc36e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ android {
2626
minSdkVersion 14
2727
targetSdkVersion 22
2828
versionCode 25
29-
versionName "2.4.25"
29+
versionName "2.4.26"
3030
// Enabling multidex support.
3131
multiDexEnabled true
3232
resConfigs "zh"

app/src/main/java/cn/darkal/networkdiagnosis/Fragment/WebViewFragment.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,13 @@ public void onReceive(Context context, Intent intent) {
272272
}
273273

274274
public void loadUrl(String url) {
275-
if (!isSetProxy) {
276-
ProxyUtils.setProxy(webView, "127.0.0.1", SysApplication.proxyPort);
277-
Log.e("~~~~", "initProxyWebView()");
278-
isSetProxy = true;
279-
}
280275
if (webView != null) {
276+
if (!isSetProxy) {
277+
ProxyUtils.setProxy(webView, "127.0.0.1", SysApplication.proxyPort);
278+
Log.e("~~~~", "initProxyWebView()");
279+
isSetProxy = true;
280+
}
281+
281282
if (!url.startsWith("http://") && !url.startsWith("https://")) {
282283
url = "http://" + url;
283284
}

app/src/main/java/cn/darkal/networkdiagnosis/Utils/ProxyUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static boolean setProxy(WebView webview, String host, int port) {
3535
} else if (sdkInt < Build.VERSION_CODES.LOLLIPOP) {
3636
return setProxyKK(webview, host, port, "android.app.Application");
3737
} else {
38-
return webview.getContext() != null && setProxyLollipop(webview.getContext(), host, port);
38+
return webview != null && setProxyLollipop(webview.getContext(), host, port);
3939
}
4040
}
4141

0 commit comments

Comments
 (0)