Skip to content

Commit

Permalink
fix: prevent crashes when trying to clear lookup search field
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Jan 27, 2025
1 parent 8630d30 commit 6241554
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/itkach/aard2/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,28 @@ public void lookupAsync(@NonNull String query) {
}

private void notifyLookupStarted(String query) {
for (LookupListener l : lookupListeners) {
l.onLookupStarted(query);
}
ThreadUtils.postOnMainThread(() -> {
for (LookupListener l : lookupListeners) {
l.onLookupStarted(query);
}
});

}

private void notifyLookupFinished(String query) {
for (LookupListener l : lookupListeners) {
l.onLookupFinished(query);
}
ThreadUtils.postOnMainThread(() -> {
for (LookupListener l : lookupListeners) {
l.onLookupFinished(query);
}
});
}

private void notifyLookupCanceled(String query) {
for (LookupListener l : lookupListeners) {
l.onLookupCanceled(query);
}
ThreadUtils.postOnMainThread(() -> {
for (LookupListener l : lookupListeners) {
l.onLookupCanceled(query);
}
});
}

private final List<LookupListener> lookupListeners = new ArrayList<>();
Expand Down

0 comments on commit 6241554

Please sign in to comment.