check for duration in json

This commit is contained in:
Milos Kozak 2017-12-05 22:08:37 +01:00
parent a47fe757b9
commit 455383cfd5

View file

@ -1353,7 +1353,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return; return;
} }
extendedBolus.date = trJson.getLong("mills"); extendedBolus.date = trJson.getLong("mills");
extendedBolus.durationInMinutes = trJson.getInt("duration"); extendedBolus.durationInMinutes = trJson.has("duration") ? trJson.getInt("duration") : 0;
extendedBolus.insulin = trJson.getDouble("relative"); extendedBolus.insulin = trJson.getDouble("relative");
extendedBolus._id = trJson.getString("_id"); extendedBolus._id = trJson.getString("_id");
createOrUpdate(extendedBolus); createOrUpdate(extendedBolus);