]> git.saurik.com Git - wxWidgets.git/commitdiff
Avoid painting generic wxDataViewCtrl if it has no columns.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 14 Dec 2009 19:17:12 +0000 (19:17 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 14 Dec 2009 19:17:12 +0000 (19:17 +0000)
The code in wxDataViewMainWindow::OnPaint() relied on having at least the
first column and didn't work for a completely empty control. Just don't paint
it at all in this case as it's unnecessary anyhow.

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

src/generic/datavgen.cpp

index 5c39027e6b8daf8478c1b4856c1c7b06a6e56e81..a13797b3f6179518439c8516e56189bd5062f6d7 100644 (file)
@@ -1565,6 +1565,13 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
 
     // compute which columns needs to be redrawn
     unsigned int cols = GetOwner()->GetColumnCount();
+    if ( !cols )
+    {
+        // we assume that we have at least one column below and painting an
+        // empty control is unnecessary anyhow
+        return;
+    }
+
     unsigned int col_start = 0;
     unsigned int x_start;
     for (x_start = 0; col_start < cols; col_start++)