fix invalid time being set when `Time.set(Time)` is being called on itself
see Etar-Group/Etar-Calendar#1151
Change-Id: I8dfcf1c7192f307dd1982adffe512cf5a1c04543
diff --git a/src/com/android/calendarcommon2/Time.java b/src/com/android/calendarcommon2/Time.java
index f0af248..b3e35ae 100644
--- a/src/com/android/calendarcommon2/Time.java
+++ b/src/com/android/calendarcommon2/Time.java
@@ -147,6 +147,10 @@
}
public void set(Time other) {
+ if (this == other) {
+ // no-op when being called on itself, see Etar-Group/Etar-Calendar#1151
+ return;
+ }
clearCalendar();
mCalendar.setTimeZone(other.getTimeZone());
mCalendar.setTimeInMillis(other.mCalendar.getTimeInMillis());