From d2fa27a7c7c34c12de51e478977d495824228d8b Mon Sep 17 00:00:00 2001 From: Tametomo Date: Tue, 21 Apr 2009 03:10:07 -0600 Subject: Fixed a Table segfault which would occur by doing division by 0 when there are no rows present. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tametomo Signed-off-by: Bjørn Lindeijer --- src/gui/table.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/table.cpp b/src/gui/table.cpp index 5ad3b5e1..c25856a2 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -500,7 +500,10 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y) int GuiTable::getRowForY(int y) { - int row = y / getRowHeight(); + int row = -1; + + if (getRowHeight() > 0) + row = y / getRowHeight(); if (row < 0 || row >= mModel->getRows()) return -1; -- cgit v1.2.3-70-g09d2