Skip to content

fix: prevent URLSpan(null) crash on unedited link tap#171

Open
Arvuno wants to merge 1 commit into
OmGodse:masterfrom
Arvuno:contrib/notally/fix-urlspan-null-crash
Open

fix: prevent URLSpan(null) crash on unedited link tap#171
Arvuno wants to merge 1 commit into
OmGodse:masterfrom
Arvuno:contrib/notally/fix-urlspan-null-crash

Conversation

@Arvuno

@Arvuno Arvuno commented May 21, 2026

Copy link
Copy Markdown

Summary

Fixes a crash when tapping an unedited link (one that was inserted but never had its URL set via the edit dialog).

Problem

When a link is inserted from the toolbar without being edited, URLSpan(null) is created with a null URL. When tapped, the LinkMovementMethod callback in TakeNote.kt calls Uri.parse(link) where link is null, causing a crash.

Fix

In the 'Open Link' handler, check if span.URL is null before attempting to parse and open it. If null, display the 'Can't open link' toast instead of crashing.

Changes

  • Modified TakeNote.kt to use span.URL directly and guard against null values

Testing

  • Insert a link via toolbar without editing it (so URL is null)
  • Tap the link and verify the app doesn't crash
  • Should show 'Can't open link' toast instead

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.

1 participant