Prevent crash

pull/147/head
M66B 7 years ago
parent 83b77ec24c
commit 4cbd0e5439

@ -53,6 +53,7 @@ import java.io.InputStream;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.lifecycle.Lifecycle;
// https://developer.android.com/reference/android/webkit/WebView // https://developer.android.com/reference/android/webkit/WebView
@ -86,11 +87,13 @@ public class FragmentWebView extends FragmentBase {
if (prefs.getBoolean("webview", false)) { if (prefs.getBoolean("webview", false)) {
view.loadUrl(url); view.loadUrl(url);
setSubtitle(url); setSubtitle(url);
return false;
} else { } else {
Helper.view(getContext(), getViewLifecycleOwner(), Uri.parse(url), true); if (getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
return true; Helper.view(getContext(), getViewLifecycleOwner(), Uri.parse(url), true);
return true;
}
} }
return false;
} }
}); });

Loading…
Cancel
Save