diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java index 5ef716bad9..cf8ff788e9 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -698,7 +698,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { .duration(trJson.getInt("duration")) .low(Profile.toMgdl(trJson.getDouble("targetBottom"), units)) .high(Profile.toMgdl(trJson.getDouble("targetTop"), units)) - .reason(trJson.getString("reason")) + .reason(JsonHelper.safeGetString(trJson, "reason", "")) ._id(trJson.getString("_id")) .source(Source.NIGHTSCOUT); createOrUpdate(tempTarget); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index bc879bc2a7..f11d5c05b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -14,6 +14,8 @@ import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.TemporaryBasal; +import info.nightscout.androidaps.events.EventAppInitialized; +import info.nightscout.androidaps.events.EventConfigBuilderChange; import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventPreferenceChange; @@ -80,7 +82,6 @@ public class StatuslinePlugin extends PluginBase { @Override protected void onStart() { MainApp.bus().register(this); - sendStatus(); super.onStart(); } @@ -182,6 +183,16 @@ public class StatuslinePlugin extends PluginBase { sendStatus(); } + @Subscribe + public void onStatusEvent(final EventAppInitialized ev) { + sendStatus(); + } + + @Subscribe + public void onStatusEvent(final EventConfigBuilderChange ev) { + sendStatus(); + } + @Subscribe public void onStatusEvent(final EventRefreshOverview ev) { //Filter events where loop is (de)activated