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);