fix NPE when profile doesn't exists

This commit is contained in:
Milos Kozak 2018-03-24 15:13:31 +01:00
parent 3d710dcf46
commit 90390c91ab

View file

@ -58,6 +58,7 @@ import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.HardLimits;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SP;
@ -327,7 +328,9 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
}
};
Double maxAbsolute = MainApp.getConstraintChecker().getMaxBasalAllowed(profile).value();
Double maxAbsolute = HardLimits.maxBasal();
if (profile != null)
maxAbsolute = MainApp.getConstraintChecker().getMaxBasalAllowed(profile).value();
editAbsolute = (NumberPicker) view.findViewById(R.id.careportal_newnstreatment_absoluteinput);
editAbsolute.setParams(0d, 0d, maxAbsolute, 0.05d, new DecimalFormat("0.00"), true, absoluteTextWatcher);