better check for null

This commit is contained in:
Milos Kozak 2017-01-12 21:55:17 +01:00
parent 74afdb6874
commit 9d8d925f75
2 changed files with 2 additions and 2 deletions

View file

@ -97,7 +97,7 @@ public class TempBasalsPlugin implements PluginBase, TempBasalsInterface {
private void initializeData() {
double dia = 3;
if (MainApp.getConfigBuilder().getActiveProfile() != null)
if (MainApp.getConfigBuilder().getActiveProfile() != null && MainApp.getConfigBuilder().getActiveProfile().getProfile() != null)
dia = MainApp.getConfigBuilder().getActiveProfile().getProfile().getDia();
long fromMills = (long) (new Date().getTime() - 60 * 60 * 1000L * (24 + dia));
tempBasals = MainApp.getDbHelper().getTempbasalsDataFromTime(fromMills, false, false);

View file

@ -88,7 +88,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
public void initializeData() {
double dia = 3;
if (MainApp.getConfigBuilder().getActiveProfile() != null)
if (MainApp.getConfigBuilder().getActiveProfile() != null && MainApp.getConfigBuilder().getActiveProfile().getProfile() != null)
dia = MainApp.getConfigBuilder().getActiveProfile().getProfile().getDia();
long fromMills = (long) (new Date().getTime() - 60 * 60 * 1000L * (24 + dia));
treatments = MainApp.getDbHelper().getTreatmentDataFromTime(fromMills, false);