Don't allow empty page numbers

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6698
This commit is contained in:
Roberto Fernandez Bautista 2021-01-20 23:34:10 +00:00 committed by Wayne Stambaugh
parent 320ca5a0d0
commit 42cbcf7ef4
2 changed files with 18 additions and 0 deletions

View File

@ -546,6 +546,13 @@ void SCH_EDIT_FRAME::CreateScreens()
m_schematic->RootScreen()->SetFileName( wxEmptyString );
// Don't leave root page number empty
SCH_SHEET_PATH rootSheetPath;
rootSheetPath.push_back( &m_schematic->Root() );
m_schematic->RootScreen()->SetPageNumber( wxT( "1" ) );
m_schematic->Root().AddInstance( rootSheetPath.Path() );
m_schematic->Root().SetPageNumber( rootSheetPath, wxT( "1" ) );
if( GetScreen() == NULL )
{
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );

View File

@ -1837,6 +1837,17 @@ void SCH_SEXPR_PARSER::parseSchSheetInstances( SCH_SHEET* aRootSheet, SCH_SCREEN
case T_page:
NeedSYMBOL();
instance.m_PageNumber = FromUTF8();
// Empty page numbers are not permitted
if( instance.m_PageNumber.IsEmpty() )
{
// Use space character instead
instance.m_PageNumber = wxT( " " );
// Set the file as modified so the user can be warned.
aScreen->SetModify();
}
NeedRIGHT();
break;