diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 11ff599f29..091b594bd4 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-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 @@ -1634,8 +1634,10 @@ void SCH_SCREEN::PruneOrphanedSymbolInstances( const wxString& aProjectName, // The project name cannot be empty. Projects older than 7.0 did not save project names // when saving instance data. Running this algorithm with an empty project name would // clobber all instance data for projects other than the current one when a schematic - // file is shared across multiple projects. - wxCHECK( !aProjectName.IsEmpty(), /* void */ ); + // file is shared across multiple projects. Because running the schematic editor in + // stand alone mode can result in an empty project name, do not assert here. + if( aProjectName.IsEmpty() ) + return; for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) ) { @@ -1679,8 +1681,10 @@ void SCH_SCREEN::PruneOrphanedSheetInstances( const wxString& aProjectName, // The project name cannot be empty. Projects older than 7.0 did not save project names // when saving instance data. Running this algorithm with an empty project name would // clobber all instance data for projects other than the current one when a schematic - // file is shared across multiple projects. - wxCHECK( !aProjectName.IsEmpty(), /* void */ ); + // file is shared across multiple projects. Because running the schematic editor in + // stand alone mode can result in an empty project name, do not assert here. + if( aProjectName.IsEmpty() ) + return; for( SCH_ITEM* item : Items().OfType( SCH_SHEET_T ) ) { @@ -2139,7 +2143,8 @@ void SCH_SCREEN::MigrateSimModels() void SCH_SCREENS::PruneOrphanedSymbolInstances( const wxString& aProjectName, const SCH_SHEET_LIST& aValidSheetPaths ) { - wxCHECK( !aProjectName.IsEmpty(), /* void */ ); + if( aProjectName.IsEmpty() ) + return; for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() ) screen->PruneOrphanedSymbolInstances( aProjectName, aValidSheetPaths ); @@ -2149,7 +2154,8 @@ void SCH_SCREENS::PruneOrphanedSymbolInstances( const wxString& aProjectName, void SCH_SCREENS::PruneOrphanedSheetInstances( const wxString& aProjectName, const SCH_SHEET_LIST& aValidSheetPaths ) { - wxCHECK( !aProjectName.IsEmpty(), /* void */ ); + if( aProjectName.IsEmpty() ) + return; for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() ) screen->PruneOrphanedSheetInstances( aProjectName, aValidSheetPaths );