From df532862b6e33e4a2924d9e53e76ff77d6110fa4 Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Tue, 31 Mar 2026 04:29:39 +0200 Subject: [PATCH] added some nil checks for api.lua --- api/api.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/api.lua b/api/api.lua index 5a3c88d1..95bdbd14 100644 --- a/api/api.lua +++ b/api/api.lua @@ -1233,7 +1233,9 @@ end function pfUI.api.BarLayoutSize(bar,barsize,formfactor,iconsize,bordersize,padding) assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutSize: barsize "..tostring(barsize).." is invalid") local formfactor = pfUI.api.BarLayoutFormfactor(formfactor) - local cols, rows = unpack(pfGridmath[barsize][formfactor]) + local layout = pfGridmath[barsize] and pfGridmath[barsize][formfactor or 1] + if not layout then layout = pfGridmath[barsize] and pfGridmath[barsize][1] or {1,1} end + local cols, rows = unpack(layout) local width = (iconsize + bordersize*2+padding) * cols + padding local height = (iconsize + bordersize*2+padding) * rows + padding bar._size = {width,height} @@ -1252,7 +1254,9 @@ function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarButtonAnchor: barsize "..tostring(barsize).." is invalid") local formfactor = pfUI.api.BarLayoutFormfactor(formfactor) local parent = button:GetParent() - local cols, rows = unpack(pfGridmath[barsize][formfactor]) + local layout = pfGridmath[barsize] and pfGridmath[barsize][formfactor or 1] + if not layout then layout = pfGridmath[barsize] and pfGridmath[barsize][1] or {1,1} end + local cols, rows = unpack(layout) if buttonindex == 1 then button._anchor = {"TOPLEFT", parent, "TOPLEFT", bordersize+padding, -bordersize-padding} else