Skip to content

Commit

Permalink
Speculative fix for the crash when a task was deleted.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabor Keszthelyi committed Jan 19, 2018
1 parent 2010e9c commit b311605
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ public interface Callback
void onTaskEditRequested(@NonNull Uri taskUri, @Nullable ContentSet data);

/**
* Called when the task has been deleted.
* Called when the task has been deleted by the user.
*/
void onTaskDeleted(@NonNull Uri taskUri);

/**
* Called when the task has been marked completed.
* Called when the task has been marked completed by the user.
*/
void onTaskCompleted(@NonNull Uri taskUri);

Expand Down Expand Up @@ -565,6 +565,7 @@ public void onClick(DialogInterface dialog, int which)
// TODO: remove the task in a background task
mContentSet.delete(mAppContext);
mCallback.onTaskDeleted(mTaskUri);
mTaskUri = null;
}
}
}).setMessage(R.string.confirm_delete_message).create().show();
Expand Down Expand Up @@ -720,7 +721,7 @@ public void onContentLoaded(ContentSet contentSet)
@Override
public void onChange(boolean selfChange)
{
if (mContentSet != null)
if (mContentSet != null && mTaskUri != null)
{
// reload the task
mContentSet.update(mAppContext, CONTENT_VALUE_MAPPER);
Expand Down

0 comments on commit b311605

Please sign in to comment.