From bad64b3301790b95a9d86b3637f920a00a339253 Mon Sep 17 00:00:00 2001 From: Valansch Date: Sun, 23 Jul 2017 04:14:50 +0200 Subject: [PATCH] fixed pull null pointer --- poll.lua | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/poll.lua b/poll.lua index ba0eb9b4..1b401fa1 100644 --- a/poll.lua +++ b/poll.lua @@ -298,19 +298,21 @@ end function poll_on_second() for _, player in pairs(game.connected_players) do - if global.poll_panel_creation_time[player.index] then - local frame = player.gui.left["poll-panel"] - if frame then - local y = (game.tick - global.poll_panel_creation_time[player.index]) / 60 - local y = global.poll_duration_in_seconds - y - y = round(y, 0) - if y <= 0 then - frame.destroy() - global.poll_panel_creation_time[player.index] = nil - else - y = "Hide (" .. y - y = y .. ")" - frame.poll_panel_button_table.poll_hide_button.caption = y + if global.poll_panel_creation_time then + if global.poll_panel_creation_time[player.index] then + local frame = player.gui.left["poll-panel"] + if frame then + local y = (game.tick - global.poll_panel_creation_time[player.index]) / 60 + local y = global.poll_duration_in_seconds - y + y = round(y, 0) + if y <= 0 then + frame.destroy() + global.poll_panel_creation_time[player.index] = nil + else + y = "Hide (" .. y + y = y .. ")" + frame.poll_panel_button_table.poll_hide_button.caption = y + end end end end