From cfffaa706b1efe593585eee77c63004a1a4813c7 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 5 May 2008 13:25:52 +0000 Subject: [PATCH] add a check to the button layout code to prevent crazy behaviour if a user sets #Rows > #Buttons --- ButtonBar.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ButtonBar.lua b/ButtonBar.lua index ee726f3..b2ea404 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -187,6 +187,10 @@ function ButtonBar:UpdateButtonLayout() local Rows = self:GetRows() local ButtonPerRow = math_floor(numbuttons / Rows + 0.5) -- just a precaution Rows = math_floor(numbuttons / ButtonPerRow + 0.5) + if Rows > numbuttons then + Rows = numbuttons + ButtonPerRow = 1 + end self:SetSize((self.button_width + pad) * ButtonPerRow - pad + 8, (self.button_height + pad) * Rows - pad + 8)