From 0d8c7ab16b674ffe8310e3525c6c1757b2463aca Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Sun, 13 Oct 2024 16:07:12 +0200 Subject: [PATCH] Nil guard for window visibility --- gfx/element.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gfx/element.lua b/gfx/element.lua index c1b569d..6f74963 100644 --- a/gfx/element.lua +++ b/gfx/element.lua @@ -126,9 +126,12 @@ function Element:_setWindow(window) end function Element:setVisible(visible) - self:setDirty() + local win = self:_getWindow() self.visible = visible - self:_getWindow().setVisible(visible) + if win ~= nil then + self:setDirty() + self:_getWindow().setVisible(visible) + end end function Element:_isDirty()