Skip to content

Commit 36c4438

Browse files
committed
Added guard to protect from invalid index error on the result of getFieldInfo
1 parent 7329ce4 commit 36c4438

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/SCRIPTS/BF/background.lua

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ local mspMsgQueued = false
99

1010
local function getSensorValue()
1111
if sensorId == -1 then
12-
sensorId = getFieldInfo(protocol.stateSensor)['id'] or -1
12+
local sensor = getFieldInfo(protocol.stateSensor)
13+
if type(sensor) == "table" then
14+
sensorId = sensor['id'] or -1
15+
end
1316
end
1417
return getValue(sensorId)
1518
end

0 commit comments

Comments
 (0)