From 3d3fcde35d0ba5dbe1b0f5b0067573120340f9e5 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 25 Feb 2019 20:12:31 +0100 Subject: [PATCH] Query for profile only once --- .../androidaps/plugins/Insulin/InsulinOrefBasePlugin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefBasePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefBasePlugin.java index a2d80efd68..d4115b3799 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefBasePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefBasePlugin.java @@ -5,6 +5,7 @@ import com.squareup.otto.Bus; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Iob; +import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.interfaces.InsulinInterface; @@ -62,7 +63,8 @@ public abstract class InsulinOrefBasePlugin extends PluginBase implements Insuli } public double getUserDefinedDia() { - return ProfileFunctions.getInstance().getProfile() != null ? ProfileFunctions.getInstance().getProfile().getDia() : MIN_DIA; + Profile profile = ProfileFunctions.getInstance().getProfile(); + return profile != null ? profile.getDia() : MIN_DIA; } public Iob iobCalcForTreatment(Treatment treatment, long time) {