Fixed a null pointer exception in task actions loader

pull/14/head
Sam Bosley 14 years ago
parent c0fddb612d
commit d1da4997da

@ -734,32 +734,34 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
Task.MODIFICATION_DATE, Task.COMPLETION_DATE); Task.MODIFICATION_DATE, Task.COMPLETION_DATE);
final Activity activity = fragment.getActivity(); final Activity activity = fragment.getActivity();
activity.runOnUiThread(new Runnable() { if (activity != null) {
@Override activity.runOnUiThread(new Runnable() {
public void run() { @Override
try { public void run() {
Task task = new Task(); try {
LinkActionExposer linkActionExposer = new LinkActionExposer(); Task task = new Task();
LinkActionExposer linkActionExposer = new LinkActionExposer();
for(fetchCursor.moveToFirst(); !fetchCursor.isAfterLast(); fetchCursor.moveToNext()) {
task.clear(); for(fetchCursor.moveToFirst(); !fetchCursor.isAfterLast(); fetchCursor.moveToNext()) {
task.readFromCursor(fetchCursor); task.clear();
if(task.isCompleted()) task.readFromCursor(fetchCursor);
continue; if(task.isCompleted())
continue;
List<TaskAction> actions = linkActionExposer.
getActionsForTask(ContextManager.getContext(), task.getId()); List<TaskAction> actions = linkActionExposer.
if (actions.size() > 0) getActionsForTask(ContextManager.getContext(), task.getId());
taskActionLoader.put(task.getId(), actions.get(0)); if (actions.size() > 0)
} taskActionLoader.put(task.getId(), actions.get(0));
if(taskActionLoader.size() > 0) { }
notifyDataSetChanged(); if(taskActionLoader.size() > 0) {
notifyDataSetChanged();
}
} finally {
fetchCursor.close();
} }
} finally {
fetchCursor.close();
} }
} });
}); }
} }
} }

Loading…
Cancel
Save