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.
This commit is contained in:
Vadim Zeitlin
2019-10-23 19:57:40 +02:00
parent b8c9e6754d
commit 669e97c016

View File

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