From f641a0cc9c09a9402d439d752788d16271e9424e Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sat, 1 Sep 2012 17:28:04 -0400 Subject: [PATCH] prevent crash with malformed sbi code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- mesecons_microcontroller/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua index a4c2741..4aa65ad 100644 --- a/mesecons_microcontroller/init.lua +++ b/mesecons_microcontroller/init.lua @@ -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)