diff --git a/sonic-boost.love/core/modules/menusystem/flowbox.lua b/sonic-boost.love/core/modules/menusystem/flowbox.lua index f1d2f23..2da91c8 100644 --- a/sonic-boost.love/core/modules/menusystem/flowbox.lua +++ b/sonic-boost.love/core/modules/menusystem/flowbox.lua @@ -107,7 +107,9 @@ function FlowBox:keyreleased(key, code) end if key == "A" then - self.widget.list[self.widget.selected]:action() + if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then + self.widget.list[self.widget.selected]:action() + end end end @@ -164,11 +166,13 @@ function FlowBox:draw() end function FlowBox:drawCursor() - local w, h = self:getWidgetSize() - local col, line = self:getCoord(self.widget.selected) - local x = (col) * h - local y = (line) * h - menuutils.drawCursor(self.x + x, self.y + y, w, h) + if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then + local w, h = self:getWidgetSize() + local col, line = self:getCoord(self.widget.selected) + local x = (col) * h + local y = (line) * h + menuutils.drawCursor(self.x + x, self.y + y, w, h) + end end return FlowBox diff --git a/sonic-boost.love/core/modules/menusystem/listbox.lua b/sonic-boost.love/core/modules/menusystem/listbox.lua index e2643d9..04f43ed 100644 --- a/sonic-boost.love/core/modules/menusystem/listbox.lua +++ b/sonic-boost.love/core/modules/menusystem/listbox.lua @@ -42,7 +42,9 @@ function ListBox:keyreleased(key, code) end if key == "A" then - self.widget.list[self.widget.selected]:action() + if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then + self.widget.list[self.widget.selected]:action() + end end end @@ -85,9 +87,11 @@ function ListBox:draw() end function ListBox:drawCursor() - local w, h = self:getWidgetSize() - local y = (self.widget.selected - 1) * h - menuutils.drawCursor(self.x,self.y + y, w, h) + if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then + local w, h = self:getWidgetSize() + local y = (self.widget.selected - 1) * h + menuutils.drawCursor(self.x,self.y + y, w, h) + end end return ListBox