Check cursor count in widget

pull/322/merge
Alex Baker 9 years ago
parent 0f4785e421
commit 99d7215ff4

@ -138,6 +138,9 @@ public class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFac
public RemoteViews buildUpdate(int position) { public RemoteViews buildUpdate(int position) {
try { try {
Task task = getTask(position); Task task = getTask(position);
if (task == null) {
return null;
}
String textContent; String textContent;
Resources r = context.getResources(); Resources r = context.getResources();
@ -194,8 +197,12 @@ public class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFac
} }
private Task getTask(int position) { private Task getTask(int position) {
cursor.moveToPosition(position); if (position < cursor.getCount()) {
return new Task(cursor); cursor.moveToPosition(position);
return new Task(cursor);
}
log.warn("requested task at position {}, cursor count is {}", position, cursor.getCount());
return null;
} }
private String getQuery() { private String getQuery() {

Loading…
Cancel
Save