Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(CodeWebView): guard external-link launch with try/catch - #446

Open
jim-daf wants to merge 1 commit into
ThirtyDegreesRay:masterfrom
jim-daf:fix-codewebview-startactivity
Open

jim-daf wants to merge 1 commit into
ThirtyDegreesRay:masterfrom
jim-daf:fix-codewebview-startactivity

Conversation

@jim-daf

@jim-daf jim-daf commented May 15, 2026

Copy link
Copy Markdown

Closes #445.

CodeWebView.startActivity(Uri) routes any tapped link out of the code-preview WebView through AppOpener.launchUrl, which on the Custom Tabs path calls customTabsIntent.launchUrl(context, Uri.parse(url)). If the chosen custom-tabs package is uninstalled between CustomTabsHelper.INSTANCE.getBestPackageName(context) and this launchUrl, the latter raises ActivityNotFoundException. The exception propagates all the way back through shouldOverrideUrlLoading and the WebView's host activity crashes mid-tap.

openInBrowser (the non-Custom-Tabs path) already shows a fallback Toast, so the equivalent guard belongs at the helper:

private void startActivity(Uri uri){
    if(uri == null) return;
    try {
        AppOpener.launchUrl(getContext(), uri);
    } catch (android.content.ActivityNotFoundException e) {
        // chosen custom-tabs / browser package disappeared between
        // selection and launch
    }
}

The happy path (URL with a viewer installed) is unchanged.

CodeWebView.shouldOverrideUrlLoading routes tapped links out via the
startActivity helper, which delegates to AppOpener.launchUrl. The
Custom Tabs path inside AppOpener calls customTabsIntent.launchUrl
without a try/catch, so if the chosen custom-tabs package is
uninstalled between CustomTabsHelper.getBestPackageName and that
launchUrl, the exception propagates back through
shouldOverrideUrlLoading and the WebView's host activity crashes
mid-tap.

The non-Custom-Tabs path (openInBrowser) already shows a fallback
Toast, so the matching guard belongs at the helper that fans both
paths out.
mrayva added a commit to mrayva/OpenHub that referenced this pull request Sep 14, 2026
…add bookmark export/import

Ported two small fixes from upstream's open PRs (ThirtyDegreesRay#446, ThirtyDegreesRay#230): CodeWebView's
external-link launch is now guarded against ActivityNotFoundException if the
chosen custom-tabs/browser package disappears mid-tap, and opening a bare
https://github.com/ link now routes to the Splash screen instead of hitting
ProfileActivity with a null username.

Also adds bookmark export/import (BookmarksFragment), mirroring the Ignore
List's SAF-based JSON export/import so bookmarks survive an app data/cache
clear. A live bookmark is really a Bookmark join row plus a LocalRepo/
LocalUser row, so BookmarkHelper flattens both into a self-contained
BookmarkBackup DTO per entry rather than exporting the join table alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H9EgHfmcSAaNsQMa7PgGWa

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CodeWebView can crash mid-tap if the chosen Custom Tabs browser is uninstalled

1 participant