Prevent null dereference

This commit is contained in:
Seth Hillbrand 2023-07-25 10:53:05 -07:00
parent 8546d417df
commit 530af96da2
1 changed files with 5 additions and 1 deletions

View File

@ -996,10 +996,14 @@ void SIMULATOR_FRAME_UI::onSignalsGridCellChanged( wxGridEvent& aEvent )
if( m_SuppressGridEvents > 0 ) if( m_SuppressGridEvents > 0 )
return; return;
SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() );
if( !plotTab )
return;
int row = aEvent.GetRow(); int row = aEvent.GetRow();
int col = aEvent.GetCol(); int col = aEvent.GetCol();
wxString text = m_signalsGrid->GetCellValue( row, col ); wxString text = m_signalsGrid->GetCellValue( row, col );
SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() );
wxString signalName = m_signalsGrid->GetCellValue( row, COL_SIGNAL_NAME ); wxString signalName = m_signalsGrid->GetCellValue( row, COL_SIGNAL_NAME );
int traceType = SPT_UNKNOWN; int traceType = SPT_UNKNOWN;
wxString vectorName = vectorNameFromSignalName( plotTab, signalName, &traceType ); wxString vectorName = vectorNameFromSignalName( plotTab, signalName, &traceType );