From ef08ef6ed1bbaaed5656a2bf88986c0e80497af4 Mon Sep 17 00:00:00 2001 From: Gyan Ponnappa <129504209+Darkeye14@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:39:50 +0530 Subject: [PATCH] fix: App Crash during activation resolved (#2225) * . * App crash during activation resolved using try and catch block --- .../java/com/mifos/feature/activate/ActivateScreen.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/feature/activate/src/main/java/com/mifos/feature/activate/ActivateScreen.kt b/feature/activate/src/main/java/com/mifos/feature/activate/ActivateScreen.kt index 8ebcbfb554..2736ca32b5 100644 --- a/feature/activate/src/main/java/com/mifos/feature/activate/ActivateScreen.kt +++ b/feature/activate/src/main/java/com/mifos/feature/activate/ActivateScreen.kt @@ -63,19 +63,24 @@ fun ActivateScreen( ActivateScreen( state = state, onActivate = { + val clientIdAsInt: Int = try { + id + } catch (e: Exception) { + 0 + } when (activateType) { Constants.ACTIVATE_CLIENT -> viewModel.activateClient( - clientId = id, + clientId = clientIdAsInt, clientPayload = it ) Constants.ACTIVATE_CENTER -> viewModel.activateCenter( - centerId = id, + centerId = clientIdAsInt, centerPayload = it ) Constants.ACTIVATE_GROUP -> viewModel.activateGroup( - groupId = id, + groupId = clientIdAsInt, groupPayload = it )