From 2ee2d1ad775cc62c0d00d437e83575656186c6e5 Mon Sep 17 00:00:00 2001 From: Domi04151309 <36272047+Domi04151309@users.noreply.github.com> Date: Mon, 29 Nov 2021 09:55:18 +0100 Subject: [PATCH] Fix crash on empty device list Closes #30 --- .../main/java/io/github/domi04151309/home/helpers/Devices.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/domi04151309/home/helpers/Devices.kt b/app/src/main/java/io/github/domi04151309/home/helpers/Devices.kt index 15baaa69..69cf25e4 100644 --- a/app/src/main/java/io/github/domi04151309/home/helpers/Devices.kt +++ b/app/src/main/java/io/github/domi04151309/home/helpers/Devices.kt @@ -37,7 +37,7 @@ class Devices(private val context: Context) { private val deviceOrder: JSONArray get() { if (!data.has("order")) { - data.put("order", devicesObject.names()) + data.put("order", devicesObject.names() ?: JSONArray()) } return data.getJSONArray("order") }