Browse Source

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

Fixes KICAD-Q7
Fixes KICAD-1A6
newinvert
Alex Shvartzkop 2 years ago
parent
commit
f071dd1406
  1. 10
      eeschema/widgets/search_handlers.h
  2. 10
      pcbnew/widgets/search_handlers.h

10
eeschema/widgets/search_handlers.h

@ -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 );

10
pcbnew/widgets/search_handlers.h

@ -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;

Loading…
Cancel
Save