]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxGridColumnOperations::GetLineBefore() for the first column.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 5 Feb 2013 20:46:03 +0000 (20:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 5 Feb 2013 20:46:03 +0000 (20:46 +0000)
We should return -1 from here as there is no column before the first one and
wxGridRowOperations::GetLineBefore() already does this.

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

include/wx/generic/private/grid.h

index 39ca13794a62cf5627452481fe5ea9d658c7fa8c..921aea39d473c73a34b3909f505ed6c1c954bae7 100644 (file)
@@ -692,7 +692,10 @@ public:
         { return grid->GetColPos(line); }
 
     virtual int GetLineBefore(const wxGrid* grid, int line) const
-        { return grid->GetColAt(wxMax(0, grid->GetColPos(line) - 1)); }
+    {
+        int posBefore = grid->GetColPos(line) - 1;
+        return posBefore >= 0 ? grid->GetColAt(posBefore) : wxNOT_FOUND;
+    }
 
     virtual wxWindow *GetHeaderWindow(wxGrid *grid) const
         { return grid->GetGridColLabelWindow(); }