prevent crash with malformed sbi code.

just inserting "sbi(A, C!=D)" into a µC without connecting it to anything
causes 'b' at line 510 to become nil, crashing the server.
This commit is contained in:
Vanessa Ezekowitz 2012-09-01 17:28:04 -04:00
parent 98b8c8da76
commit f641a0cc9c
1 changed files with 1 additions and 0 deletions

View File

@ -505,6 +505,7 @@ function yc_command_parsecondition(cond, L, eeprom)
if cond:sub(i+1, i+1) == nil then break end
if s == "=" then
if a==nil then return nil end
if b==nil then return nil end
if a == b then buf = "1" end
if a ~= b then buf = "0" end
cond = string.gsub(cond, b..s..a, buf)