From fc0bcdc8a3c1020fe2388b52a76548fac9daf631 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 11 Jul 2025 18:13:27 +0100 Subject: [PATCH] Remove double-assert. (getPropertyFromEvent() already asserts if it can't find one.) --- eeschema/widgets/sch_properties_panel.cpp | 32 ++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/eeschema/widgets/sch_properties_panel.cpp b/eeschema/widgets/sch_properties_panel.cpp index 309929ca05..bf3705ea2e 100644 --- a/eeschema/widgets/sch_properties_panel.cpp +++ b/eeschema/widgets/sch_properties_panel.cpp @@ -159,24 +159,26 @@ void SCH_PROPERTIES_PANEL::valueChanging( wxPropertyGridEvent& aEvent ) SCH_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool(); const SELECTION& selection = selectionTool->GetSelection(); - EDA_ITEM* item = selection.Front(); + EDA_ITEM* frontItem = selection.Front(); - PROPERTY_BASE* property = getPropertyFromEvent( aEvent ); - wxCHECK( property, /* void */ ); - wxCHECK( item, /* void */ ); - - wxVariant newValue = aEvent.GetPropertyValue(); - - if( VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), item ) ) - { - wxString errorMsg = wxString::Format( wxS( "%s: %s" ), wxGetTranslation( property->Name() ), - validationFailure->get()->Format( m_frame ) ); - m_frame->ShowInfoBarError( errorMsg ); - aEvent.Veto(); + if( !frontItem ) return; - } - aEvent.Skip(); + if( PROPERTY_BASE* property = getPropertyFromEvent( aEvent ) ) + { + wxVariant newValue = aEvent.GetPropertyValue(); + + if( VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), frontItem ) ) + { + wxString errorMsg = wxString::Format( wxS( "%s: %s" ), wxGetTranslation( property->Name() ), + validationFailure->get()->Format( m_frame ) ); + m_frame->ShowInfoBarError( errorMsg ); + aEvent.Veto(); + return; + } + + aEvent.Skip(); + } }