resolve NPE
This commit is contained in:
parent
683caf78f8
commit
d642418e02
|
@ -347,13 +347,12 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasalData getBasalData(long time) {
|
public BasalData getBasalData(Profile profile, long time) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
time = roundUpTime(time);
|
time = roundUpTime(time);
|
||||||
BasalData retval = basalDataTable.get(time);
|
BasalData retval = basalDataTable.get(time);
|
||||||
if (retval == null) {
|
if (retval == null) {
|
||||||
retval = new BasalData();
|
retval = new BasalData();
|
||||||
Profile profile = MainApp.getConfigBuilder().getProfile(time);
|
|
||||||
TemporaryBasal tb = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(time);
|
TemporaryBasal tb = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(time);
|
||||||
retval.basal = profile.getBasal(time);
|
retval.basal = profile.getBasal(time);
|
||||||
if (tb != null) {
|
if (tb != null) {
|
||||||
|
|
|
@ -136,7 +136,9 @@ public class GraphData {
|
||||||
double lastBaseBasal = 0;
|
double lastBaseBasal = 0;
|
||||||
double lastTempBasal = 0;
|
double lastTempBasal = 0;
|
||||||
for (long time = fromTime; time < toTime; time += 60 * 1000L) {
|
for (long time = fromTime; time < toTime; time += 60 * 1000L) {
|
||||||
BasalData basalData = IobCobCalculatorPlugin.getPlugin().getBasalData(time);
|
Profile profile = MainApp.getConfigBuilder().getProfile(time);
|
||||||
|
if (profile == null) continue;
|
||||||
|
BasalData basalData = IobCobCalculatorPlugin.getPlugin().getBasalData(profile, time);
|
||||||
double baseBasalValue = basalData.basal;
|
double baseBasalValue = basalData.basal;
|
||||||
double absoluteLineValue = baseBasalValue;
|
double absoluteLineValue = baseBasalValue;
|
||||||
double tempBasalValue = 0;
|
double tempBasalValue = 0;
|
||||||
|
|
Loading…
Reference in a new issue