threadpresenter: add null check for thread to findPostById.

refactor-toolbar
Floens 8 years ago
parent 16ef48f65b
commit c8553bc9cf
  1. 9
      Clover/app/src/main/java/org/floens/chan/core/presenter/ThreadPresenter.java

@ -709,9 +709,12 @@ public class ThreadPresenter implements ChanLoader.ChanLoaderCallback, PostAdapt
}
private Post findPostById(int id) {
for (Post post : chanLoader.getThread().posts) {
if (post.no == id) {
return post;
ChanThread thread = chanLoader.getThread();
if (thread != null) {
for (Post post : thread.posts) {
if (post.no == id) {
return post;
}
}
}
return null;

Loading…
Cancel
Save