Skip to content

Commit 596eb75

Browse files
authored
Merge pull request #617 from NYPL-Simplified/thread-crash-on-book-return-fix
Fix crash when returning a book
2 parents 64ab66b + e706193 commit 596eb75

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

simplified-app-shared/src/main/java/org/nypl/simplified/app/catalog/CatalogBookDetailView.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,18 +1052,20 @@ public Object some(final Some<URI> s) {
10521052
}
10531053
};
10541054

1055-
if (related_book_link.isSome()) {
1056-
final Button books_button = CatalogBookDetailView.this.related_books_button;
1057-
if (books_button != null) {
1058-
// set the "Related Books" section visibility to display, and set the button to listen for user actions
1059-
CatalogBookDetailView.this.related_layout.setVisibility(View.VISIBLE);
1060-
1061-
books_button.setOnClickListener(related_book_listener);
1055+
UIThread.runOnUIThread(() -> {
1056+
if (related_book_link.isSome()) {
1057+
final Button books_button = CatalogBookDetailView.this.related_books_button;
1058+
if (books_button != null) {
1059+
// set the "Related Books" section visibility to display, and set the button to listen for user actions
1060+
CatalogBookDetailView.this.related_layout.setVisibility(View.VISIBLE);
1061+
1062+
books_button.setOnClickListener(related_book_listener);
1063+
}
10621064
}
1063-
}
10641065

1065-
final Button report_button = this.book_download_report_button;
1066-
report_button.setOnClickListener(new CatalogBookReport(this.activity, e));
1066+
final Button report_button = this.book_download_report_button;
1067+
report_button.setOnClickListener(new CatalogBookReport(this.activity, e));
1068+
});
10671069
}//onStatus
10681070

10691071

0 commit comments

Comments
 (0)