Merge pull request #170 from davidsulpy/master

Fixed a potential bug if a InitialState SmartApp hasn't been updated
This commit is contained in:
Kristofer Schaller
2015-10-05 11:39:31 -07:00

View File

@@ -341,6 +341,13 @@ def eventHandler(name, value) {
def eventBuffer = atomicState.eventBuffer
def epoch = now() / 1000
// if for some reason this code block is being run
// but the SmartApp wasn't propery setup during install
// we need to set initialize the eventBuffer.
if (!atomicState.eventBuffer) {
atomicState.eventBuffer = []
}
eventBuffer << [key: "$name", value: "$value", epoch: "$epoch"]
log.debug eventBuffer