From c966dfda13de59ca227216616c8b7ffd0853d665 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 20 Oct 2021 15:57:07 +0200 Subject: [PATCH] do not throw exception if profile doesn't exist --- .../plugins/configBuilder/ProfileFunctionImplementation.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt index 529eb8d104..a7096aaef9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt @@ -154,8 +154,7 @@ class ProfileFunctionImplementation @Inject constructor( } override fun createProfileSwitch(durationInMinutes: Int, percentage: Int, timeShiftInHours: Int): Boolean { - val profile = repository.getPermanentProfileSwitch(dateUtil.now()) - ?: throw InvalidParameterSpecException("No active ProfileSwitch") + val profile = repository.getPermanentProfileSwitch(dateUtil.now()) ?: return false val profileStore = activePlugin.activeProfileSource.profile ?: return false val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now()) val validity = ProfileSealed.PS(ps).isValid(