diff --git a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp index ff3f7312ff..67fc32bca8 100644 --- a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp +++ b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp @@ -5037,6 +5037,12 @@ SCH_TABLE* SCH_IO_KICAD_SEXPR_PARSER::parseSchTable() } } + if( !table->GetCell( 0, 0 ) ) + { + THROW_PARSE_ERROR( _( "Invalid table: no cells defined" ), CurSource(), CurLine(), CurLineNumber(), + CurOffset() ); + } + return table.release(); } diff --git a/eeschema/sch_table.cpp b/eeschema/sch_table.cpp index 8723818511..9ee8042b2b 100644 --- a/eeschema/sch_table.cpp +++ b/eeschema/sch_table.cpp @@ -261,7 +261,9 @@ void SCH_TABLE::RunOnChildren( const std::function& aFunction const BOX2I SCH_TABLE::GetBoundingBox() const { - // Note: a table with no cells is not allowed + if( m_cells.empty() ) + return BOX2I(); + BOX2I bbox = m_cells[0]->GetBoundingBox(); bbox.Merge( m_cells[m_cells.size() - 1]->GetBoundingBox() );