]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/adapters/WebViewPagerAdapter.java
Fix a periodic crash while loading the SSL Certificate Error Dialog. https://redmine...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / adapters / WebViewPagerAdapter.java
index 256e654236d7fe5b0ed7fdb0e7680c9882d0b0bb..da8e6729a74700eacad960ed98df0720afb4565e 100644 (file)
@@ -89,6 +89,13 @@ public class WebViewPagerAdapter extends FragmentPagerAdapter {
             i++;
         }
 
+        // Set the position to be the last tab if it is not found.
+        // Sometimes there is a race condition in populating the webView fragments list when resuming Privacy Browser and displaying an SSL certificate error while loading a new intent.
+        // In that case, the last tab should be the one it is looking for.
+        if (position == -1) {
+            position = webViewFragmentsList.size() - 1;
+        }
+
         // Return the position.
         return position;
     }