From 332e3869deade9fc9579d74983e069b20c7184b7 Mon Sep 17 00:00:00 2001 From: BoatsandJoes Date: Mon, 6 Dec 2021 22:38:07 -0600 Subject: [PATCH] Replay menu no longer crashes if level or timer is nil. --- scene/replay_select.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scene/replay_select.lua b/scene/replay_select.lua index f1e43f6..c52d96c 100644 --- a/scene/replay_select.lua +++ b/scene/replay_select.lua @@ -129,7 +129,13 @@ function ReplaySelectScene:render() love.graphics.setFont(font_3x5_2) for idx, replay in ipairs(replays) do if(idx >= self.menu_state.replay-9 and idx <= self.menu_state.replay+9) then - local display_string = os.date("%c", replay["timestamp"]).." "..replay["mode"].." "..replay["ruleset"].." Level: "..replay["level"].." Time: "..formatTime(replay["timer"]) + local display_string = os.date("%c", replay["timestamp"]).." "..replay["mode"].." "..replay["ruleset"] + if replay["level"] ~= nil then + display_string = display_string.." Level: "..replay["level"] + end + if replay["timer"] ~= nil then + display_string = display_string.." Time: "..formatTime(replay["timer"]) + end love.graphics.printf(display_string, 6, (260 - 20*(self.menu_state.replay)) + 20 * idx, 640, "left") end end