diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index f0be2d8723..f2134ffc89 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1884,7 +1884,7 @@ void wxGenericTreeCtrl::EnsureVisible(const wxTreeItemId& item) if ( HasFlag(wxTR_HIDE_ROOT) ) { - while ( parent != m_anchor ) + while ( parent && parent != m_anchor ) { Expand(parent); parent = parent->GetParent();