Don't assert in wxGenericFileCtrl if there is no selected file.

Don't use the list control item if there is no selection in it.

Closes #16684.
This commit is contained in:
Kevin B. McCarty
2015-05-09 18:54:55 +02:00
committed by Vadim Zeitlin
parent 97286e13bd
commit 5e376532f7

View File

@@ -1064,10 +1064,15 @@ wxFileName wxGenericFileCtrl::DoGetFileName() const
wxListItem item;
item.m_itemId = m_list->GetNextItem(-1, wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
// ... if anything is selected in the list
if ( item.m_itemId != wxNOT_FOUND )
{
m_list->GetItem(item);
fn.Assign(m_list->GetDir(), item.m_text);
}
}
else // user entered the value
{
// the path can be either absolute or relative