Author: mordante
Date: Fri Jun 20 22:32:10 2008
New Revision: 27364

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27364&view=rev
Log:
Make sure we don't try to devide by zero, which means something else is 
probably wrong.

Modified:
    trunk/src/gui/widgets/listbox.cpp

Modified: trunk/src/gui/widgets/listbox.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/listbox.cpp?rev=27364&r1=27363&r2=27364&view=diff
==============================================================================
--- trunk/src/gui/widgets/listbox.cpp (original)
+++ trunk/src/gui/widgets/listbox.cpp Fri Jun 20 22:32:10 2008
@@ -310,8 +310,14 @@
 
        // FIXME we assume fixed row height atm.
        if(rows_.size() > 0) {
-               const unsigned rows = list()->get_best_size().y / 
rows_[0].get_height();
-               scrollbar()->set_visible_items(rows);
+               const unsigned row_height = rows_[0].get_height();
+               if(row_height) {
+                       const unsigned rows = list()->get_best_size().y / 
row_height;
+                       scrollbar()->set_visible_items(rows);
+               } else {
+                       WRN_G << "Listbox row 0 has no height, making all rows 
visible.\n";
+                       scrollbar()->set_visible_items(rows_.size());
+               }
        } else {
                scrollbar()->set_visible_items(1);
        }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to