Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ public NoteListWidgetFactory(Context context, Intent intent) {
mIsLight = intent.getExtras() == null || intent.getExtras().getBoolean(EXTRA_IS_LIGHT, true);
}

@Override
public int getCount() {
return mCursor.getCount();
}
@Override
public int getCount() {
// Defensively check if the cursor is null or closed.
// This prevents a NullPointerException if getCount() is called before
// onDataSetChanged() has finished initializing the cursor.
if (mCursor == null || mCursor.isClosed()) {
return 0;
}
return mCursor.getCount();
}

@Override
public long getItemId(int position) {
Expand Down
Loading