Skip to content

Commit

Permalink
Fix potential "image is nil" error in [message]
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Apr 5, 2016
1 parent d3374d3 commit a275f22
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions data/lua/wml/message.lua
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit a275f22

Please sign in to comment.