Resolve text variables before attempting to open datasheet.

(cherry picked from commit 510dc28a5c)
This commit is contained in:
Jeff Young 2022-02-18 21:43:37 +00:00
parent b041a77cfa
commit da82ba00e4
1 changed files with 6 additions and 1 deletions

View File

@ -517,13 +517,18 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front(); SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
datasheet = symbol->GetField( DATASHEET_FIELD )->GetText(); // Use GetShownText() to resolve any text variables
datasheet = symbol->GetField( DATASHEET_FIELD )->GetShownText();
} }
if( datasheet.IsEmpty() || datasheet == wxT( "~" ) ) if( datasheet.IsEmpty() || datasheet == wxT( "~" ) )
{
m_frame->ShowInfoBarError( _( "No datasheet defined." ) ); m_frame->ShowInfoBarError( _( "No datasheet defined." ) );
}
else else
{
GetAssociatedDocument( m_frame, datasheet, &m_frame->Prj() ); GetAssociatedDocument( m_frame, datasheet, &m_frame->Prj() );
}
return 0; return 0;
} }