From: Vadim Zeitlin Date: Fri, 16 Feb 2007 17:41:58 +0000 (+0000) Subject: don't delete inexistent column indices in DeleteCols() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b2df5ddf6a575a5c0d84f76f1f84c456679ce7d6 don't delete inexistent column indices in DeleteCols() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index e3436a8233..4fe9067298 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++ )