mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 21:28:34 +00:00
Fix crash in conversation search.
This commit is contained in:
parent
a079e479ec
commit
1fc63b7597
@ -64,19 +64,27 @@ public class ConversationSearchViewModel extends AndroidViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onMoveUp() {
|
void onMoveUp() {
|
||||||
|
if (result.getValue() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
debouncer.clear();
|
debouncer.clear();
|
||||||
|
|
||||||
CursorList<MessageResult> messages = (CursorList<MessageResult>) result.getValue().getResults();
|
List<MessageResult> messages = result.getValue().getResults();
|
||||||
int position = Math.min(result.getValue().getPosition() + 1, messages.size() - 1);
|
int position = Math.min(result.getValue().getPosition() + 1, messages.size() - 1);
|
||||||
|
|
||||||
result.setValue(new SearchResult(messages, position));
|
result.setValue(new SearchResult(messages, position));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMoveDown() {
|
void onMoveDown() {
|
||||||
|
if (result.getValue() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
debouncer.clear();
|
debouncer.clear();
|
||||||
|
|
||||||
CursorList<MessageResult> messages = (CursorList<MessageResult>) result.getValue().getResults();
|
List<MessageResult> messages = result.getValue().getResults();
|
||||||
int position = Math.max(result.getValue().getPosition() - 1, 0);
|
int position = Math.max(result.getValue().getPosition() - 1, 0);
|
||||||
|
|
||||||
result.setValue(new SearchResult(messages, position));
|
result.setValue(new SearchResult(messages, position));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user