diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2014-04-18 15:07:18 +0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-18 13:52:40 -0700 |
commit | 59333225c5f2a38bcdaa430c9e5f36ae974ee62a (patch) | |
tree | 41da7b289afef69f6d537eb89972b491fb9df1b6 /src | |
parent | 1a5902d2c9fdd512e7a904b7d880c0f6a3e18e97 (diff) | |
download | android_packages_apps_Calendar-59333225c5f2a38bcdaa430c9e5f36ae974ee62a.tar.gz android_packages_apps_Calendar-59333225c5f2a38bcdaa430c9e5f36ae974ee62a.tar.bz2 android_packages_apps_Calendar-59333225c5f2a38bcdaa430c9e5f36ae974ee62a.zip |
Calendar: Check if the duration is empty before parser it when delete the events
If the event end time is 0, it will calculate the end time by "duration"
string. But if the "duration" is null, it will lead the NullPointerException.
So check the duration string is empty or not before use it to get the end
time when delete the events.
CRs-Fixed: 650814
Change-Id: I97350db4103959b851367beae53f09200a2a29b8
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/calendar/DeleteEventsActivity.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/com/android/calendar/DeleteEventsActivity.java b/src/com/android/calendar/DeleteEventsActivity.java index f763675c..02a597e5 100644 --- a/src/com/android/calendar/DeleteEventsActivity.java +++ b/src/com/android/calendar/DeleteEventsActivity.java @@ -315,12 +315,15 @@ public class DeleteEventsActivity extends ListActivity // if DTEND invalid, check for duration if (end == 0) { String durationStr = cursor.getString(cursor.getColumnIndex(Events.DURATION)); - Duration duration = new Duration(); - try { - duration.parse(durationStr); - end = start + duration.getMillis(); - } catch (DateException e) { - Log.w(TAG, e.getLocalizedMessage()); + if (durationStr != null) { + Duration duration = new Duration(); + + try { + duration.parse(durationStr); + end = start + duration.getMillis(); + } catch (DateException e) { + Log.w(TAG, e.getLocalizedMessage()); + } } } if (DEBUG) Log.v(TAG, |