1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

fixed ANR

This commit is contained in:
Nikolay Pultsin 2015-09-04 12:42:39 +01:00
parent 224cea97c1
commit c2bafbed15
2 changed files with 17 additions and 15 deletions

View file

@ -624,27 +624,29 @@ public final class FBReaderApp extends ZLApplication {
return; return;
} }
cursor = new ZLTextWordCursor(cursor);
if (cursor.isNull()) {
return;
}
final ZLTextView textView = getTextView(); final ZLTextView textView = getTextView();
final ZLTextModel textModel;
final Book book;
final AutoTextSnippet snippet;
// textView.model will not be changed inside synchronised block // textView.model will not be changed inside synchronised block
synchronized (textView) { synchronized (textView) {
textModel = textView.getModel();
final BookModel model = Model; final BookModel model = Model;
final Book book = model != null ? model.Book : null; book = model != null ? model.Book : null;
if (book == null || textView != BookTextView || textView.getModel() == null) { if (book == null || textView != BookTextView || textModel == null) {
return; return;
} }
cursor = new ZLTextWordCursor(cursor); snippet = new AutoTextSnippet(cursor, 30);
if (cursor.isNull()) {
return;
}
updateInvisibleBookmarksList(new Bookmark(
Collection,
book,
textView.getModel().getId(),
new AutoTextSnippet(cursor, 30),
false
));
} }
updateInvisibleBookmarksList(new Bookmark(
Collection, book, textModel.getId(), snippet, false
));
} }
public void addInvisibleBookmark() { public void addInvisibleBookmark() {

View file

@ -89,7 +89,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
Application.getViewWidget().reset(); Application.getViewWidget().reset();
} }
public ZLTextModel getModel() { public final ZLTextModel getModel() {
return myModel; return myModel;
} }