mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 17:25:33 +00:00
Protect search from mis-attributed LIB/SCH instance
The parent of fields might be a LIB_SYMBOL, not SCH_SYMBOL. We need to watch for and avoid these in the search/replace for schematics Fixes https://gitlab.com/kicad/code/kicad/-/issues/20079
This commit is contained in:
parent
907f21e739
commit
ea520da1c8
@ -657,8 +657,13 @@ bool SCH_FIELD::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) co
|
||||
if( searchAndReplace && !replaceReferences )
|
||||
return false;
|
||||
|
||||
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
|
||||
wxASSERT( parentSymbol );
|
||||
SCH_SYMBOL* parentSymbol = dyn_cast<SCH_SYMBOL*>( m_parent );
|
||||
|
||||
// The parent might be a LIB_SYMBOL, in which case, we don't
|
||||
// have a sheet path to resolve the reference.
|
||||
if( !parentSymbol )
|
||||
return false;
|
||||
|
||||
wxASSERT( aAuxData );
|
||||
|
||||
// Take sheet path into account which effects the reference field and the unit for
|
||||
|
Loading…
Reference in New Issue
Block a user