Fix NPE trying to open a book

This commit is contained in:
Bradlee Speice 2014-10-12 21:27:48 -04:00
parent 2ee16ceb4f
commit bfde7d5839

View File

@ -70,9 +70,9 @@ public class ExpListNavDrawerFragment extends NavDrawerFragment {
// I really don't like how we build the chapters, but I'm not adding Guava just for Range. // I really don't like how we build the chapters, but I'm not adding Guava just for Range.
// RXJava does get ridiculous with the angle brackets, you have me there. But Intellij // RXJava does get ridiculous with the angle brackets, you have me there. But Intellij
// folds nicely. // folds nicely.
Map<String, List<Integer>> chapterMap = new HashMap<String, List<Integer>>(); Map<String, List<Integer>> chapterMap;
if (mainBook != null) { if (mainBook != null) {
vUtil.getBooks(mainBook).map(new Func1<BibleBook, Map<String, List<Integer>>>() { chapterMap = vUtil.getBooks(mainBook).map(new Func1<BibleBook, Map<String, List<Integer>>>() {
@Override @Override
public Map<String, List<Integer>> call(BibleBook bibleBook) { public Map<String, List<Integer>> call(BibleBook bibleBook) {
// These lines are important // These lines are important
@ -103,13 +103,13 @@ public class ExpListNavDrawerFragment extends NavDrawerFragment {
}) })
.toBlocking() .toBlocking()
.first(); .first();
ExpListNavAdapter<String, Integer> adapter =
new ExpListNavAdapter<String, Integer>(bibleBooks, chapterMap);
mActualListView.setAdapter(adapter);
} }
ExpListNavAdapter<String, Integer> adapter =
new ExpListNavAdapter<String, Integer>(bibleBooks, chapterMap);
mActualListView.setAdapter(adapter);
mActualListView.setItemChecked(mCurrentSelectedPosition, true); mActualListView.setItemChecked(mCurrentSelectedPosition, true);
return mActualListView; return mActualListView;
} }