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 3cd1f8fe27..99785ebbd5 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 @@ -44,10 +44,6 @@ public class StatuslinePlugin implements PluginBase { StatuslinePlugin(Context ctx) { this.ctx = ctx; this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx); - - if (fragmentEnabled) { - MainApp.bus().register(this); - } } @Override @@ -107,11 +103,15 @@ public class StatuslinePlugin implements PluginBase { this.fragmentEnabled = fragmentEnabled; if (fragmentEnabled) { - MainApp.bus().register(this); + try { + MainApp.bus().register(this); + } catch (Exception e) {} sendStatus(); } else{ - MainApp.bus().unregister(this); + try { + MainApp.bus().unregister(this); + } catch (Exception e) {} sendStatus(); } }