Merge remote-tracking branch 'origin/dev' into combo-scripter-v2

* origin/dev:
  autofix error in profile
This commit is contained in:
Johannes Mockenhaupt 2017-12-30 19:59:39 +01:00
commit 99f3fb6216
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -23,6 +23,7 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.ToastUtils;
@ -163,15 +164,19 @@ public class Profile {
for (Integer index = 0; index < array.length(); index++) {
try {
final JSONObject o = array.getJSONObject(index);
long tas = getShitfTimeSecs((int) o.getLong("timeAsSeconds"));
long tas = 0;
try {
tas = getShitfTimeSecs((int) o.getLong("timeAsSeconds"));
} catch (JSONException e) {
String time = o.getString("time");
tas = getShitfTimeSecs(DateUtil.toSeconds(time));
//log.debug(">>>>>>>>>>>> Used recalculated timeAsSecons: " + time + " " + tas);
}
Double value = o.getDouble("value") * multiplier;
sparse.put(tas, value);
} catch (JSONException e) {
log.error("Unhandled exception", e);
try {
log.error(array.getJSONObject(index).toString());
} catch (JSONException e1) {
}
log.error(json.toString());
}
}