Fix access into empty container.
Fixes https://gitlab.com/kicad/code/kicad/issues/6840
(cherry picked from commit 359c29639f
)
This commit is contained in:
parent
07568f87c3
commit
1f6ff4a519
|
@ -145,12 +145,11 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch )
|
|||
// is called, GetParent() will return nullptr. While this works for some calls, it
|
||||
// segfaults when we have our first library expanded.
|
||||
// The tree will be expanded again below when we get our matches
|
||||
if( !aSearch.IsNull() )
|
||||
if( !aSearch.IsNull() && m_tree.Children.size() )
|
||||
m_widget->Collapse( wxDataViewItem( &*m_tree.Children[0] ) );
|
||||
|
||||
// Even with the updateLock, wxWidgets sometimes ties its knickers in
|
||||
// a knot when trying to run a wxdataview_selection_changed_callback()
|
||||
// on a row that has been deleted.
|
||||
// Even with the updateLock, wxWidgets sometimes ties its knickers in a knot trying to
|
||||
// run a wxdataview_selection_changed_callback() on a row that has been deleted.
|
||||
// https://bugs.launchpad.net/kicad/+bug/1756255
|
||||
m_widget->UnselectAll();
|
||||
|
||||
|
|
Loading…
Reference in New Issue