Browse Source

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
revert-0c36e162
Seth Hillbrand 8 months ago
parent
commit
ea520da1c8
  1. 9
      eeschema/sch_field.cpp

9
eeschema/sch_field.cpp

@ -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…
Cancel
Save