Skip to content

Commit

Permalink
isUpdated tolerates missing columns fixes #1017 (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmfs authored Mar 21, 2021
1 parent a053c78 commit f5ad4ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public boolean isUpdated(FieldAdapter<?, TaskAdapter> fieldAdapter)
{
return false;
}
Object oldValue = fieldAdapter.getFrom(mCursor);
Object oldValue = fieldAdapter.existsIn(mCursor) ? fieldAdapter.getFrom(mCursor) : null;
Object newValue = fieldAdapter.getFrom(mValues);
// we need to special case RRULE, because RecurrenceRule doesn't support `equals`
if (fieldAdapter != TaskAdapter.RRULE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ public boolean isSetIn(ContentValues values)
public boolean existsIn(Cursor cursor)
{
int columnIdx = cursor.getColumnIndex(fieldName());
if (columnIdx < 0)
{
throw new IllegalArgumentException("The column '" + fieldName() + "' is missing in cursor.");
}

return !cursor.isNull(columnIdx);
return columnIdx >= 0 && !cursor.isNull(columnIdx);
}


Expand Down

0 comments on commit f5ad4ae

Please sign in to comment.