Fix NullPointerException

This commit is contained in:
2017-05-30 09:22:15 -04:00
parent 238a1c724d
commit b6501c9a29
3 changed files with 6 additions and 1 deletions

View File

@@ -192,7 +192,7 @@ public abstract class CheckmarkList
Checkmark newest = getNewestComputed(); Checkmark newest = getNewestComputed();
Checkmark oldest = getOldestComputed(); Checkmark oldest = getOldestComputed();
if (newest == null) if (newest == null || oldest == null)
{ {
forceRecompute(from, to); forceRecompute(from, to);
} }
@@ -208,6 +208,7 @@ public abstract class CheckmarkList
* *
* @return oldest checkmark already computed * @return oldest checkmark already computed
*/ */
@Nullable
protected abstract Checkmark getOldestComputed(); protected abstract Checkmark getOldestComputed();
/** /**
@@ -285,5 +286,6 @@ public abstract class CheckmarkList
* *
* @return newest checkmark already computed * @return newest checkmark already computed
*/ */
@Nullable
protected abstract Checkmark getNewestComputed(); protected abstract Checkmark getNewestComputed();
} }

View File

@@ -72,6 +72,7 @@ public class MemoryCheckmarkList extends CheckmarkList
} }
@Override @Override
@Nullable
protected Checkmark getOldestComputed() protected Checkmark getOldestComputed()
{ {
if(list.isEmpty()) return null; if(list.isEmpty()) return null;
@@ -79,6 +80,7 @@ public class MemoryCheckmarkList extends CheckmarkList
} }
@Override @Override
@Nullable
protected Checkmark getNewestComputed() protected Checkmark getNewestComputed()
{ {
if(list.isEmpty()) return null; if(list.isEmpty()) return null;

View File

@@ -153,6 +153,7 @@ public class SQLiteCheckmarkList extends CheckmarkList
} }
@Override @Override
@Nullable
protected Checkmark getOldestComputed() protected Checkmark getOldestComputed()
{ {
check(habit.getId()); check(habit.getId());