Skip to content

Commit acb0239

Browse files
authored
Merge pull request #94 from codecae/bg_sensorid_fix
Fix invalid index error on the result of getFieldInfo in background.lua
2 parents 7329ce4 + 36c4438 commit acb0239

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)