Remove bogus assert. Also fix const leak.
Fixes https://gitlab.com/kicad/code/kicad/issues/4367
This commit is contained in:
parent
3c3984a6fc
commit
ae102c7411
|
@ -566,19 +566,21 @@ void SCH_COMPONENT::SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSel
|
|||
}
|
||||
|
||||
|
||||
SCH_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
|
||||
SCH_FIELD* SCH_COMPONENT::GetField( int aFieldNdx )
|
||||
{
|
||||
const SCH_FIELD* field;
|
||||
|
||||
if( (unsigned) aFieldNdx < m_Fields.size() )
|
||||
field = &m_Fields[aFieldNdx];
|
||||
else
|
||||
field = NULL;
|
||||
return &m_Fields[aFieldNdx];
|
||||
|
||||
wxASSERT_MSG( field, wxString::Format( "No field ID %d found in symbol %s.",
|
||||
aFieldNdx, m_Uuid.AsString() ) );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return const_cast<SCH_FIELD*>( field );
|
||||
|
||||
const SCH_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
|
||||
{
|
||||
if( (unsigned) aFieldNdx < m_Fields.size() )
|
||||
return &m_Fields[aFieldNdx];
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -389,7 +389,9 @@ public:
|
|||
*
|
||||
* @return is the field at \a aFieldNdx or NULL if the field does not exist.
|
||||
*/
|
||||
SCH_FIELD* GetField( int aFieldNdx ) const;
|
||||
SCH_FIELD* GetField( int aFieldNdx );
|
||||
|
||||
const SCH_FIELD* GetField( int aFieldNdx ) const;
|
||||
|
||||
/**
|
||||
* Search for a field named \a aFieldName and returns text associated with this field.
|
||||
|
|
Loading…
Reference in New Issue