diff --git a/user-lock-manager.smartapp.groovy b/user-lock-manager.smartapp.groovy index 8752d13..9899530 100644 --- a/user-lock-manager.smartapp.groovy +++ b/user-lock-manager.smartapp.groovy @@ -161,9 +161,15 @@ def userHrefTitle(i) { return title } def userHrefDescription(i) { + if (!state.codeUsage) { + state.codeUsage = [:] + } + if (!state.codeUsage["code${i}"]) { + state.codeUsage["code${i}"] = 0 + } def uc = settings."userCode${i}" def us = settings."userSlot${i}" - def usage = state.codeUsage["code${i}"] + def usage = state?.codeUsage["code${i}"] def description = "" if (us != null) { description += "Slot: ${us}"