pcb_parser: fix an incorrect CHECK_MSG when parsing a dimension in a footprint.

this incorrect CHECK_MSG created a crash.
Fixes #11859
https://gitlab.com/kicad/code/kicad/issues/11859
This commit is contained in:
jean-pierre charras 2022-06-20 10:42:19 +02:00
parent 73836b50fc
commit c8ce01ce8e
1 changed files with 3 additions and 1 deletions

View File

@ -3321,8 +3321,10 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
case T_text_frame: case T_text_frame:
{ {
wxCHECK_MSG( dim->Type() == PCB_DIM_LEADER_T, nullptr, KICAD_T expected_type = aInFP ? PCB_FP_DIM_LEADER_T : PCB_DIM_LEADER_T;
wxCHECK_MSG( dim->Type() == expected_type, nullptr,
wxT( "Invalid text_frame token" ) ); wxT( "Invalid text_frame token" ) );
PCB_DIM_LEADER* leader = static_cast<PCB_DIM_LEADER*>( dim.get() ); PCB_DIM_LEADER* leader = static_cast<PCB_DIM_LEADER*>( dim.get() );
int textFrame = parseInt( "dim text frame mode" ); int textFrame = parseInt( "dim text frame mode" );