fix crash in wxDataViewItem GetNextItem() when there are no item.
Fixes #9540 https://gitlab.com/kicad/code/kicad/issues/9540
This commit is contained in:
parent
97e9348ee1
commit
4293caf00c
|
@ -42,20 +42,29 @@ wxDataViewItem GetPrevItem( wxDataViewCtrl const& aView, wxDataViewItem const& a
|
||||||
wxDataViewItem GetNextItem( wxDataViewCtrl const& aView, wxDataViewItem const& aItem )
|
wxDataViewItem GetNextItem( wxDataViewCtrl const& aView, wxDataViewItem const& aItem )
|
||||||
{
|
{
|
||||||
wxDataViewItem nextItem;
|
wxDataViewItem nextItem;
|
||||||
|
wxDataViewItem invalid;
|
||||||
|
|
||||||
if( !aItem.IsOk() )
|
if( !aItem.IsOk() )
|
||||||
{
|
{
|
||||||
// No selection. Select the first.
|
// No selection. Select the first.
|
||||||
wxDataViewItemArray children;
|
wxDataViewItemArray children;
|
||||||
aView.GetModel()->GetChildren( aItem, children );
|
aView.GetModel()->GetChildren( aItem, children );
|
||||||
return children[0];
|
|
||||||
|
if( children.size() )
|
||||||
|
return children[0];
|
||||||
|
|
||||||
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aView.IsExpanded( aItem ) )
|
if( aView.IsExpanded( aItem ) )
|
||||||
{
|
{
|
||||||
wxDataViewItemArray children;
|
wxDataViewItemArray children;
|
||||||
aView.GetModel()->GetChildren( aItem, children );
|
aView.GetModel()->GetChildren( aItem, children );
|
||||||
nextItem = children[0];
|
|
||||||
|
if( children.size() )
|
||||||
|
return children[0];
|
||||||
|
|
||||||
|
return invalid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue