diff --git a/Modules/Config.lua b/Modules/Config.lua index 585195e..d6a90f3 100644 --- a/Modules/Config.lua +++ b/Modules/Config.lua @@ -230,18 +230,24 @@ StaticGridFrame = { ---@param rowspan number ---@param colspan number Add = function(self, frame, rowspan, colspan) + if rowspan > self.rows or colspan > self.columns then + print("Rowspan or colspan exceeds grid dimensions.") + return + end + for row = 1, self.rows do for col = 1, self.columns do if not self.occupancy[row][col] then local canPlace = true for r = row, row + rowspan - 1 do for c = col, col + colspan - 1 do - if not self.occupancy[r] or self.occupancy[r][c] then + -- Check if r or c is out of bounds or if the cell is occupied + if r > self.rows or c > self.columns or self.occupancy[r][c] then canPlace = false break end - if not canPlace then break end end + if not canPlace then break end end if canPlace then local x = (col - 1) * self.cellWidth