From 102ae320a51ad320c05055ce06586062d57ae68f Mon Sep 17 00:00:00 2001 From: Erik Thayer Date: Fri, 20 Mar 2015 11:55:53 -0500 Subject: [PATCH] fix code usage init --- user-lock-manager.smartapp.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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}"