From 90c54a93a98eb534810265fd3a57dc92c09d0199 Mon Sep 17 00:00:00 2001 From: mueller-ma Date: Sun, 22 Oct 2023 13:29:14 +0200 Subject: [PATCH] Review Signed-off-by: mueller-ma --- .../background/ItemsControlsProviderService.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mobile/src/main/java/org/openhab/habdroid/background/ItemsControlsProviderService.kt b/mobile/src/main/java/org/openhab/habdroid/background/ItemsControlsProviderService.kt index ecdadff663..e0d55112da 100644 --- a/mobile/src/main/java/org/openhab/habdroid/background/ItemsControlsProviderService.kt +++ b/mobile/src/main/java/org/openhab/habdroid/background/ItemsControlsProviderService.kt @@ -97,13 +97,12 @@ class ItemsControlsProviderService : ControlsProviderService() { } val topic = event.getString("topic") val topicPath = topic.split('/') - /* Possible formats: - * - openhab/items//statechanged - * - openhab/items///statechanged - * When an update for a group is sent, there's also one for the individual item. - * Therefore always take the element on index two. - */ - if (topicPath.size !in intArrayOf(4, 5)) { + // Possible formats: + // - openhab/items//statechanged + // - openhab/items///statechanged + // When an update for a group is sent, there's also one for the individual item. + // Therefore always take the element on index two. + if (topicPath.size !in 4..5) { throw JSONException("Unexpected topic path $topic") } val item = allItems[topicPath[2]]