fix a crash

This commit is contained in:
Ashley Hughes 2014-02-06 22:52:22 +00:00
parent 899fadb916
commit 8d1047d05c

View File

@ -88,11 +88,15 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
if (mDatePickerResultCount++ == 0) { if (mDatePickerResultCount++ == 0) {
GregorianCalendar date = new GregorianCalendar(TimeZone.getTimeZone("UTC")); GregorianCalendar date = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
date.set(year, monthOfYear, dayOfMonth); date.set(year, monthOfYear, dayOfMonth);
if (mOriginalExpiryDate != null) {
long numDays = (date.getTimeInMillis() / 86400000) - (mOriginalExpiryDate.getTimeInMillis() / 86400000); long numDays = (date.getTimeInMillis() / 86400000) - (mOriginalExpiryDate.getTimeInMillis() / 86400000);
if (numDays == 0) if (numDays == 0)
setExpiryDate(mOriginalExpiryDate); setExpiryDate(mOriginalExpiryDate);
else else
setExpiryDate(date); setExpiryDate(date);
} else {
setExpiryDate(date);
}
if (mEditorListener != null) { if (mEditorListener != null) {
mEditorListener.onEdited(); mEditorListener.onEdited();
} }