Nullptr safety.

This commit is contained in:
Jeff Young 2023-09-13 15:26:29 +01:00
parent 47dc86c1e2
commit 948fea4be8
1 changed files with 4 additions and 1 deletions

View File

@ -393,6 +393,9 @@ int SYMBOL_EDITOR_CONTROL::RenameSymbol( const TOOL_EVENT& aEvent )
LIB_SYMBOL* libSymbol = libMgr.GetBufferedSymbol( oldName, libName );
bool isCurrentSymbol = editFrame->IsCurrentSymbol( libId );
if( !libSymbol )
return 0;
libSymbol->SetName( newName );
if( libSymbol->GetFieldById( VALUE_FIELD )->GetText() == oldName )
@ -401,7 +404,7 @@ int SYMBOL_EDITOR_CONTROL::RenameSymbol( const TOOL_EVENT& aEvent )
libMgr.UpdateSymbolAfterRename( libSymbol, newName, libName );
libMgr.SetSymbolModified( newName, libName );
if( isCurrentSymbol )
if( isCurrentSymbol && editFrame->GetCurSymbol())
{
libSymbol = editFrame->GetCurSymbol();