]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Fix a rare crash when the system back button is selected. https://redmine.stoutner...
authorSoren Stoutner <soren@stoutner.com>
Sat, 10 Dec 2022 19:10:59 +0000 (12:10 -0700)
committerSoren Stoutner <soren@stoutner.com>
Sat, 10 Dec 2022 19:10:59 +0000 (12:10 -0700)
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java

index 461c7405e59c0e9dd6c76e2a7e2420f3f14c1263..637e9a52ae572e9ae4a3d0d40936aeb7af71c444 100644 (file)
@@ -638,7 +638,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 } else if (displayingFullScreenVideo) {  // A full screen video is shown.
                     // Exit the full screen video.
                     exitFullScreenVideo();
-                } else if (currentWebView.canGoBack()) {  // There is at least one item in the current WebView history.
+                    // It shouldn't be possible for the currentWebView to be null, but crash logs indicate it sometimes happens.
+                } else if ((currentWebView != null) && (currentWebView.canGoBack())) {  // There is at least one item in the current WebView history.
                     // Get the current web back forward list.
                     WebBackForwardList webBackForwardList = currentWebView.copyBackForwardList();