diff options
author | Tametomo <irarice@gmail.com> | 2009-04-21 03:10:07 -0600 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-29 20:10:03 +0200 |
commit | d2fa27a7c7c34c12de51e478977d495824228d8b (patch) | |
tree | b04d94ed9b3aa21465051b8211ec66e80e80525c /src/gui/table.cpp | |
parent | 514f4e398a6d2d40327ffc72b127fc6ee7a38526 (diff) | |
download | mana-d2fa27a7c7c34c12de51e478977d495824228d8b.tar.gz mana-d2fa27a7c7c34c12de51e478977d495824228d8b.tar.bz2 mana-d2fa27a7c7c34c12de51e478977d495824228d8b.tar.xz mana-d2fa27a7c7c34c12de51e478977d495824228d8b.zip |
Fixed a Table segfault which would occur by doing division by 0 when
there are no rows present.
Signed-off-by: Tametomo <irarice@gmail.com>
Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
Diffstat (limited to 'src/gui/table.cpp')
-rw-r--r-- | src/gui/table.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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; |