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 issue with search in ActionBar #1738

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Laky-64
Copy link

@Laky-64 Laky-64 commented Dec 29, 2022

This pull request fixes an issue where searching for the "from:" keyword in the ActionBar would cause the app to crash. The issue was caused by attempting to access a line in the layout that did not exist. The solution is to add a check to ensure that the line offset is within the bounds of the layout before attempting to access it. This fix will prevent the app from crashing when searching for "from:" in the ActionBar.

This pull request fixes an issue where searching for the "from:" keyword in the ActionBar would cause the app to crash. The issue was caused by attempting to access a line in the layout that did not exist. The solution is to add a check to ensure that the line offset is within the bounds of the layout before attempting to access it. This fix will prevent the app from crashing when searching for "from:" in the ActionBar.
@@ -147,6 +147,7 @@ protected void onTextChanged(CharSequence text, int start, int lengthBefore, int

Layout layout = getLayout();
if (text instanceof Spannable && layout != null) {
if (start > layout.getLineCount()) return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

start is an offset, not line index; did you mean layout.getText().length()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants