Prevent crash

This commit is contained in:
M66B 2019-01-22 15:55:21 +00:00
parent 82a4b3c4b9
commit ae5a2a51ea
1 changed files with 33 additions and 31 deletions

View File

@ -82,37 +82,39 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
}
private void load() {
if (model != null)
executor.submit(new Runnable() {
@Override
public void run() {
try {
searching = model.isSearching();
handler.post(new Runnable() {
@Override
public void run() {
intf.onLoading();
}
});
model.load();
} catch (final Throwable ex) {
Log.e("Boundary", ex);
handler.post(new Runnable() {
@Override
public void run() {
intf.onError(ex);
}
});
} finally {
searching = false;
handler.post(new Runnable() {
@Override
public void run() {
intf.onLoaded();
}
});
}
executor.submit(new Runnable() {
@Override
public void run() {
if (model == null)
return;
try {
searching = model.isSearching();
handler.post(new Runnable() {
@Override
public void run() {
intf.onLoading();
}
});
model.load();
} catch (final Throwable ex) {
Log.e("Boundary", ex);
handler.post(new Runnable() {
@Override
public void run() {
intf.onError(ex);
}
});
} finally {
searching = false;
handler.post(new Runnable() {
@Override
public void run() {
intf.onLoaded();
}
});
}
});
}
});
}
}