7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 08:41:41 +00:00

Do not crash after dismissing assert dialog in schematic reference lister.

Using wxASSERT to check for a null pointer will crash after dismissing the
assertion dialog in debug builds and crash in release builds.  Use wxCHECK
to take the correct action to prevent the crash.
This commit is contained in:
Wayne Stambaugh 2024-10-10 08:20:51 -04:00
parent 94bf0a33b0
commit a34c6ecd03

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 1992-2018 jean-pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -377,7 +377,9 @@ void SCH_REFERENCE_LIST::ReannotateByOptions( ANNOTATE_ORDER_T aSort
if( aHierarchy )
{
SCH_SHEET_PATH* path = aHierarchy->FindSheetForPath( &ref.GetSheetPath() );
wxASSERT_MSG( path, wxT( "Attempting to annotate item on sheet not part of the hierarchy?" ) );
wxCHECK2_MSG( path, continue,
wxS( "Attempting to annotate item on sheet not part of the "
"hierarchy?" ) );
ref.SetSheetNumber( path->GetVirtualPageNumber() );
}