diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SafetyFragment/SafetyFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/SafetyFragment/SafetyFragment.java index 743e4753b1..d042d9dd9a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SafetyFragment/SafetyFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SafetyFragment/SafetyFragment.java @@ -100,6 +100,7 @@ public class SafetyFragment extends Fragment implements PluginBase, ConstraintsI Double maxBasal = SafeParse.stringToDouble(SP.getString("openapsma_max_basal", "1")); NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile(); + if (profile == null) return absoluteRate; if (absoluteRate < 0) absoluteRate = 0d; Integer maxBasalMult = 4; @@ -131,6 +132,7 @@ public class SafetyFragment extends Fragment implements PluginBase, ConstraintsI Double maxBasal = SafeParse.stringToDouble(SP.getString("openapsma_max_basal", "1")); NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile(); + if (profile == null) return percentRate; Double currentBasal = profile.getBasal(profile.secondsFromMidnight()); Double absoluteRate = currentBasal * ((double) percentRate / 100);