X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03966fcb3f5aeea7d8e6652d40e6804811a785d8..0d81b3cd93ae360405b3b98f92b6e43cbf4f23c1:/src/common/treebase.cpp diff --git a/src/common/treebase.cpp b/src/common/treebase.cpp index 548b01fb76..7a1a2d8fcf 100644 --- a/src/common/treebase.cpp +++ b/src/common/treebase.cpp @@ -110,13 +110,19 @@ void wxTreeCtrlBase::SetItemState(const wxTreeItemId& item, int state) { if ( state == wxTREE_ITEMSTATE_NEXT ) { - state = GetItemState(item) + 1; + int current = GetItemState(item); + if ( current == wxTREE_ITEMSTATE_NONE ) + return; + state = current + 1; if ( m_imageListState && state >= m_imageListState->GetImageCount() ) state = 0; } else if ( state == wxTREE_ITEMSTATE_PREV ) { - state = GetItemState(item) - 1; + int current = GetItemState(item); + if ( current == wxTREE_ITEMSTATE_NONE ) + return; + state = current - 1; if ( state == -1 ) state = m_imageListState ? m_imageListState->GetImageCount() - 1 : 0; }