Skip to content

Commit

Permalink
fix: fix feedback window crash when no color found
Browse files Browse the repository at this point in the history
  • Loading branch information
gwatcha committed Aug 29, 2020
1 parent d2b8676 commit 88eeca8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/gui/feedback/message.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ function drawMessage(self)
if self.mode ~= "normal" then
local mode_str_w = gfx.measurestr(self.mode)
gfx.x = self.w - mode_str_w - self.pad
gui_utils.styled_draw(self.mode, "feedback_main", self.props.colors[self.mode])
local mode_color = self.props.colors[self.mode]
gui_utils.styled_draw(self.mode, "feedback_main", mode_color)
end
end

Expand Down
6 changes: 5 additions & 1 deletion internal/gui/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ end

function gui_utils.styled_draw(text, text_preset, color)
Font.set(text_preset)
Color.set(color)
if color then
Color.set(color)
log.warn("No color passed for styled draw when drawing: " .. text)
end

gfx.drawstr(text)
end

Expand Down

0 comments on commit 88eeca8

Please sign in to comment.