Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Crash on inserting mention #WPB-15717 #3856

Merged
merged 5 commits into from
Feb 6, 2025

Conversation

borichellow
Copy link
Contributor

@borichellow borichellow commented Feb 4, 2025

BugWPB-15717 [Android] play store crashes when inserting a mention

What's new in this PR?

Issues

Crash in PlayStore while inserting mention.

Causes (Optional)

Hard to understand exact STR, but the crash happens when mentions place in text can't be found. In that case mention's position is -1 and crash come up in String.subSequence(0, -1)

Solutions

Added checking if mention position and length are good, do not add mention otherwise and added logs.

@borichellow borichellow self-assigned this Feb 4, 2025
@borichellow borichellow changed the title fix: Crash on inserting mention #WPB15717 fix: Crash on inserting mention #WPB-15717 Feb 4, 2025
@codecov-commenter
Copy link

codecov-commenter commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 45.46%. Comparing base (5084c57) to head (6202c10).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
.../messagecomposer/state/MessageCompositionHolder.kt 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3856      +/-   ##
===========================================
+ Coverage    45.23%   45.46%   +0.22%     
===========================================
  Files          491      491              
  Lines        17006    17008       +2     
  Branches      2845     2846       +1     
===========================================
+ Hits          7693     7732      +39     
+ Misses        8529     8489      -40     
- Partials       784      787       +3     
Files with missing lines Coverage Δ
.../ui/home/messagecomposer/EnabledMessageComposer.kt 0.00% <ø> (ø)
.../messagecomposer/state/MessageCompositionHolder.kt 46.51% <50.00%> (+18.27%) ⬆️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5084c57...6202c10. Read the comment docs.

Copy link
Contributor

@yamilmedina yamilmedina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add tests for this case, apart from that good catch 🦅 :D

@@ -200,6 +201,10 @@ class MessageCompositionHolder(
userId = UserId(contact.id, contact.domain),
handler = String.MENTION_SYMBOL + contact.name
)
if (mention.start < 0 || mention.length < 2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Perhaps we can add tests for this case, I see we have a few on MessageCompositionHolderTest :D

Copy link

sonarqubecloud bot commented Feb 5, 2025

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Built wire-android-staging-compat-pr-3856.apk is available for download

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Built wire-android-dev-debug-pr-3856.apk is available for download

@borichellow borichellow added this pull request to the merge queue Feb 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 6, 2025
@borichellow borichellow added this pull request to the merge queue Feb 6, 2025
Merged via the queue into develop with commit 24cdf16 Feb 6, 2025
13 checks passed
@borichellow borichellow deleted the fix/crash_on_inserting_mention branch February 6, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants