Skip to content

Commit

Permalink
Merge pull request #52 from udaysrinath/master
Browse files Browse the repository at this point in the history
Fix NPE in onRestoreInstanceState() for lastSelectedDay
  • Loading branch information
Jonatan E. Salas authored Nov 17, 2017
2 parents 2a74737 + 1681aa3 commit 61025ae
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,14 @@ protected void onRestoreInstanceState(Parcelable state) {
currentMonthIndex = savedInstanceState.getInt(KEY_MONTH_INDEX);
if (savedInstanceState.getSerializable(KEY_SELECTED_DATE) != null) {
lastSelectedDay = (Date) savedInstanceState.getSerializable(KEY_SELECTED_DATE);
} else {
lastSelectedDay = new Date();
}
}
Calendar calendar = (lastSelectedDay != null) ? getCalDate(lastSelectedDay) : Calendar.getInstance(Locale.getDefault());
Calendar calendar = getCalDate(lastSelectedDay);
update(calendar);

if (lastSelectedDay != null) {
markDateAsSelected(lastSelectedDay);
onDateClickListener.onDateClick(lastSelectedDay);
}
markDateAsSelected(lastSelectedDay);
onDateClickListener.onDateClick(lastSelectedDay);
}

super.onRestoreInstanceState(state);
Expand Down

0 comments on commit 61025ae

Please sign in to comment.