Fix a search pane crash when a row isn't in the hit list.

Fixes KICAD-Q7
Fixes KICAD-1A6
This commit is contained in:
Alex Shvartzkop 2023-08-25 23:24:32 +03:00
parent 0fcf9e2c7d
commit f071dd1406
2 changed files with 18 additions and 2 deletions

View File

@ -48,7 +48,15 @@ public:
wxString GetResultCell( int aRow, int aCol ) override
{
return getResultCell( m_hitlist[aRow], aCol );
if( aRow >= m_hitlist.size() )
return wxEmptyString;
const SCH_SEARCH_HIT& hit = m_hitlist[aRow];
if( !hit.item )
return wxEmptyString;
return getResultCell( hit, aCol );
}
void FindAll( const std::function<bool( SCH_ITEM*, SCH_SHEET_PATH* )>& aCollector );

View File

@ -39,7 +39,15 @@ public:
wxString GetResultCell( int aRow, int aCol ) override
{
return getResultCell( m_hitlist[aRow], aCol );
if( aRow >= m_hitlist.size() )
return wxEmptyString;
BOARD_ITEM* item = m_hitlist[aRow];
if( !item )
return wxEmptyString;
return getResultCell( item, aCol );
}
void Sort( int aCol, bool aAscending ) override;