cover more situations when profile does not exist
This commit is contained in:
parent
2eed46b3d2
commit
b9798fe9f2
1 changed files with 2 additions and 0 deletions
|
@ -100,6 +100,7 @@ public class SafetyFragment extends Fragment implements PluginBase, ConstraintsI
|
||||||
Double maxBasal = SafeParse.stringToDouble(SP.getString("openapsma_max_basal", "1"));
|
Double maxBasal = SafeParse.stringToDouble(SP.getString("openapsma_max_basal", "1"));
|
||||||
|
|
||||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||||
|
if (profile == null) return absoluteRate;
|
||||||
if (absoluteRate < 0) absoluteRate = 0d;
|
if (absoluteRate < 0) absoluteRate = 0d;
|
||||||
|
|
||||||
Integer maxBasalMult = 4;
|
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"));
|
Double maxBasal = SafeParse.stringToDouble(SP.getString("openapsma_max_basal", "1"));
|
||||||
|
|
||||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||||
|
if (profile == null) return percentRate;
|
||||||
Double currentBasal = profile.getBasal(profile.secondsFromMidnight());
|
Double currentBasal = profile.getBasal(profile.secondsFromMidnight());
|
||||||
|
|
||||||
Double absoluteRate = currentBasal * ((double) percentRate / 100);
|
Double absoluteRate = currentBasal * ((double) percentRate / 100);
|
||||||
|
|
Loading…
Reference in a new issue