fix null pointer exception
This commit is contained in:
parent
79ef93a839
commit
2c2d837079
2 changed files with 18 additions and 1 deletions
|
@ -59,11 +59,15 @@ public class TempBasal {
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
Double basalRate = profile.getBasal(profile.secondsFromMidnight(time));
|
||||||
|
|
||||||
|
if (basalRate == null)
|
||||||
|
return result;
|
||||||
|
|
||||||
int realDuration = getRealDuration();
|
int realDuration = getRealDuration();
|
||||||
|
|
||||||
if (realDuration > 0) {
|
if (realDuration > 0) {
|
||||||
Double netBasalRate = 0d;
|
Double netBasalRate = 0d;
|
||||||
Double basalRate = profile.getBasal(profile.secondsFromMidnight(time));
|
|
||||||
Double tempBolusSize = 0.05;
|
Double tempBolusSize = 0.05;
|
||||||
|
|
||||||
if (isExtended) {
|
if (isExtended) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.NSClientInternal.data;
|
package info.nightscout.androidaps.plugins.NSClientInternal.data;
|
||||||
|
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
@ -178,6 +180,7 @@ public class NSProfile {
|
||||||
return TimeZone.getDefault();
|
return TimeZone.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getValueToTime(JSONArray array, Integer timeAsSeconds) {
|
public Double getValueToTime(JSONArray array, Integer timeAsSeconds) {
|
||||||
Double lastValue = null;
|
Double lastValue = null;
|
||||||
|
|
||||||
|
@ -221,10 +224,12 @@ public class NSProfile {
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getIsf(Integer timeAsSeconds) {
|
public Double getIsf(Integer timeAsSeconds) {
|
||||||
return getIsf(getDefaultProfile(), timeAsSeconds);
|
return getIsf(getDefaultProfile(), timeAsSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getIsf(JSONObject profile, Integer timeAsSeconds) {
|
public Double getIsf(JSONObject profile, Integer timeAsSeconds) {
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -251,10 +256,12 @@ public class NSProfile {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getIc(Integer timeAsSeconds) {
|
public Double getIc(Integer timeAsSeconds) {
|
||||||
return getIc(getDefaultProfile(), timeAsSeconds);
|
return getIc(getDefaultProfile(), timeAsSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getIc(JSONObject profile, Integer timeAsSeconds) {
|
public Double getIc(JSONObject profile, Integer timeAsSeconds) {
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -281,10 +288,12 @@ public class NSProfile {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getBasal(Integer timeAsSeconds) {
|
public Double getBasal(Integer timeAsSeconds) {
|
||||||
return getBasal(getDefaultProfile(), timeAsSeconds);
|
return getBasal(getDefaultProfile(), timeAsSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getBasal(JSONObject profile, Integer timeAsSeconds) {
|
public Double getBasal(JSONObject profile, Integer timeAsSeconds) {
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -339,10 +348,12 @@ public class NSProfile {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getTargetLow(Integer timeAsSeconds) {
|
public Double getTargetLow(Integer timeAsSeconds) {
|
||||||
return getTargetLow(getDefaultProfile(), timeAsSeconds);
|
return getTargetLow(getDefaultProfile(), timeAsSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getTargetLow(JSONObject profile, Integer timeAsSeconds) {
|
public Double getTargetLow(JSONObject profile, Integer timeAsSeconds) {
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -354,10 +365,12 @@ public class NSProfile {
|
||||||
return 0D;
|
return 0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getTargetHigh(Integer timeAsSeconds) {
|
public Double getTargetHigh(Integer timeAsSeconds) {
|
||||||
return getTargetHigh(getDefaultProfile(), timeAsSeconds);
|
return getTargetHigh(getDefaultProfile(), timeAsSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Double getTargetHigh(JSONObject profile, Integer timeAsSeconds) {
|
public Double getTargetHigh(JSONObject profile, Integer timeAsSeconds) {
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue