From cefb28b4d724b8b5caedfd49f782d1921cccb4ab Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 16 Feb 2007 17:43:39 +0000 Subject: [PATCH] don't delete inexistent column indices in DeleteCols() [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44513 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index c8e4b7cc5c..4bd5a22d97 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3648,7 +3648,12 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) if ( !m_colLabels.IsEmpty() ) { - m_colLabels.RemoveAt( colID, numCols ); + // m_colLabels stores just as many elements as it needs, e.g. if only + // the label of the first column had been set it would have only one + // element and not numCols, so account for it + int nToRm = m_colLabels.size() - colID; + if ( nToRm > 0 ) + m_colLabels.RemoveAt( colID, nToRm ); } for ( row = 0; row < curNumRows; row++ )