fix ProfileSwitch loading
This commit is contained in:
parent
8ae817cdda
commit
3d1b500395
|
@ -1531,7 +1531,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
//add last one without duration
|
||||
ProfileSwitch last = getLastProfileSwitchWithoutDuration();
|
||||
if (last != null) {
|
||||
if (!profileSwitches.contains(last))
|
||||
if (!isInList(profileSwitches, last))
|
||||
profileSwitches.add(last);
|
||||
}
|
||||
return profileSwitches;
|
||||
|
@ -1541,6 +1541,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
boolean isInList(List<ProfileSwitch> profileSwitches, ProfileSwitch last) {
|
||||
for (ProfileSwitch ps : profileSwitches) {
|
||||
if (ps.isEqual(last)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ProfileSwitch getLastProfileSwitchWithoutDuration() {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue