From 669e97c0169a6fb997816520e329a9f065db414a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 23 Oct 2019 19:57:40 +0200 Subject: [PATCH] Ignore attempts to set order of empty wxMSWHeaderCtrl This can happen when using wxGrid and calling UseNativeColHeader() before adding any columns and shouldn't be fatal, so simply don't do anything in this case. --- src/msw/headerctrl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp index a56296d5c8..58afd7e608 100644 --- a/src/msw/headerctrl.cpp +++ b/src/msw/headerctrl.cpp @@ -540,6 +540,13 @@ void wxMSWHeaderCtrl::DoInsertItem(const wxHeaderColumn& col, unsigned int idx) void wxMSWHeaderCtrl::SetColumnsOrder(const wxArrayInt& order) { + // This can happen if we don't have any columns at all and "order" is empty + // anyhow in this case, so we don't have anything to do (note that we + // already know that the input array contains m_numColumns elements, as + // it's checked by the public SetColumnsOrder()). + if ( !m_numColumns ) + return; + wxArrayInt orderShown; orderShown.reserve(m_numColumns);