Fix potential "image is nil" error in [message]

This commit is contained in:
Celtic Minstrel 2016-04-04 20:55:45 -04:00
parent d3374d3670
commit a275f22ebe

View file

@ -24,6 +24,10 @@ local function get_image(cfg, speaker)
image = speaker.portrait
end
if image == "none" or image == nil then
return "", true
end
if image:find("~RIGHT%(%)") then
left_side = false
-- The percent signs escape the parentheses for a literal match
@ -38,10 +42,6 @@ local function get_image(cfg, speaker)
image = image:gsub("~LEFT%(%)", "")
end
if image == "none" or image == nil then
return "", true
end
return image, left_side
end