prevent NPE when 'chapters' is null

This commit is contained in:
Tom Hennen 2015-09-13 19:04:23 -04:00
parent 88050cff9f
commit 79f0eca912
1 changed files with 5 additions and 3 deletions

View File

@ -163,9 +163,11 @@ public class ChapterListAdapter extends ArrayAdapter<Chapter> {
public int getCount() {
// ignore invalid chapters
int counter = 0;
for (Chapter chapter : chapters) {
if (!ignoreChapter(chapter)) {
counter++;
if (chapters != null) {
for (Chapter chapter : chapters) {
if (!ignoreChapter(chapter)) {
counter++;
}
}
}
return counter;