From cc11aa25b73ee3aa6e69c58123079e5d07e13124 Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:25:30 -0230 Subject: [PATCH] check if button exists first --- data/ui_scripts/frontend_menus/utils.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/ui_scripts/frontend_menus/utils.lua b/data/ui_scripts/frontend_menus/utils.lua index 7abe1926..f394e0ae 100644 --- a/data/ui_scripts/frontend_menus/utils.lua +++ b/data/ui_scripts/frontend_menus/utils.lua @@ -17,6 +17,9 @@ local SetButtonState = function(button, state) end local RemoveButton = function(buttonTable, button) + if not button then + return + end for id, v in pairs(buttonTable) do if buttonTable[id].optionDisplay == button.stringRef then table.remove(buttonTable, id) @@ -31,6 +34,9 @@ local RemoveSpaces = function(buttonTable) end local GetButtonIndex = function(buttonTable, button) + if not button then + return nil + end for id, v in pairs(buttonTable) do if buttonTable[id].optionDisplay == button.stringRef then return id