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:IndexOutOfBoundsException in NoteEditor.kt(addMediaFileToField) #17408

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Prince-kushwaha
Copy link
Contributor

@Prince-kushwaha Prince-kushwaha commented Nov 10, 2024

Purpose / Description

IndexOutOfBoundsException in addMediaFileToField(NoteEditor.kt)

Fixes

How Has This Been Tested?

tested note editor on physical device

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

withCol {
NoteService.importMediaToDirectory(this, field)
}
if (index >= 0 && index < editFields!!.size) {
Copy link
Member

Choose a reason for hiding this comment

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

So this now determines we have a problem, and avoids the problem, which does stop the crash

... but it doesn't seem to fix the problem

Were you able to reproduce this error? What is the actual problem leading us to have the incorrect index / field mapping here?

Because if we go out of bounds we crash but what if we are frequently incorrect in the index/field mappings and we are frequently not going out of bounds but we are scribbling into the wrong field via incorrect mappings that are still in bounds?

Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

does not seem to address root cause

@mikehardy mikehardy added the Needs Author Reply Waiting for a reply from the original author label Nov 10, 2024
@Prince-kushwaha
Copy link
Contributor Author

Hi @mikehardy, i tried different way to reproduce this issue. But not able to reproduce the issue .

@Prince-kushwaha
Copy link
Contributor Author

Prince-kushwaha commented Nov 14, 2024

I think, it could be due to some underlying race condition

@mikehardy
Copy link
Member

Without a reproduction and a fix of the root cause this PR cannot be merged. Better to crash then continue silently corrupting data with mismatched field indices

@mikehardy mikehardy marked this pull request as draft November 14, 2024 16:54
Copy link
Contributor

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Author Reply Waiting for a reply from the original author Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NoteEditor: addMediaFileToField - IndexOutOfBoundsException
2 participants