]> git.saurik.com Git - wxWidgets.git/commitdiff
Add checks of wxGridSizer::Set{Cols,Rows}() arguments.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 2 Aug 2009 00:48:49 +0000 (00:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 2 Aug 2009 00:48:49 +0000 (00:48 +0000)
Number of rows or columns must be positive (see #11040).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61574 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/sizer.h

index 0bcc34cb34c5d931bbc1d34ae3eedaec895afaae..95509ce990453d405374100f40955d9a1fcd70ae 100644 (file)
@@ -732,8 +732,18 @@ public:
     virtual void RecalcSizes();
     virtual wxSize CalcMin();
 
     virtual void RecalcSizes();
     virtual wxSize CalcMin();
 
-    void SetCols( int cols )    { m_cols = cols; }
-    void SetRows( int rows )    { m_rows = rows; }
+    void SetCols( int cols )
+    {
+        wxASSERT_MSG( cols >= 0, "Number of columns must be positive");
+        m_cols = cols;
+    }
+
+    void SetRows( int rows )
+    {
+        wxASSERT_MSG( rows >= 0, "Number of rows must be positive");
+        m_rows = rows;
+    }
+
     void SetVGap( int gap )     { m_vgap = gap; }
     void SetHGap( int gap )     { m_hgap = gap; }
     int GetCols() const         { return m_cols; }
     void SetVGap( int gap )     { m_vgap = gap; }
     void SetHGap( int gap )     { m_hgap = gap; }
     int GetCols() const         { return m_cols; }