]> git.tdb.fi Git - libs/gltk.git/commitdiff
Don't divide by zero when autosizing a List with no items
authorMikko Rasa <tdb@tdb.fi>
Sun, 16 Jun 2013 20:21:21 +0000 (23:21 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 16 Jun 2013 20:34:54 +0000 (23:34 +0300)
source/list.cpp

index 4ce35e266f4418accb2b9b2716480dc1451f20ad..0faf151456efd9703d605b8de5e9bb26c58c9c58 100644 (file)
@@ -72,7 +72,7 @@ void List::autosize_rows(unsigned n)
                        total_h += igeom.h;
                }
 
-               if(items.size()<n)
+               if(!items.empty() && items.size()<n)
                        total_h = total_h*n/items.size();
 
                geom.w = max(geom.w, max_w+margin.left+margin.right);