From 3b28ba83c6b7601b6daa7f0a090e6c437d6f05e6 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Fri, 29 Sep 2023 12:17:30 +0300 Subject: [PATCH] EasyEDA Pro: don't fail on attributes for dimensions. --- common/plugins/easyedapro/easyedapro_parser.cpp | 6 +++++- pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/plugins/easyedapro/easyedapro_parser.cpp b/common/plugins/easyedapro/easyedapro_parser.cpp index 240810591b..126daf1bd2 100644 --- a/common/plugins/easyedapro/easyedapro_parser.cpp +++ b/common/plugins/easyedapro/easyedapro_parser.cpp @@ -68,7 +68,11 @@ void EASYEDAPRO::from_json( const nlohmann::json& j, EASYEDAPRO::PCB_ATTR& d ) d.position = VECTOR2D( j.at( 5 ), j.at( 6 ) ); d.key = j.at( 7 ).get(); - d.value = j.at( 8 ).get(); + + if( j.at( 8 ).is_string() ) + d.value = j.at( 8 ).get(); + else if( j.at( 8 ).is_number_integer() ) + d.value << ( j.at( 8 ).get() ); if( j.at( 9 ).is_number() ) d.keyVisible = j.at( 9 ).get(); diff --git a/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp b/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp index d013dfcc4f..ffa6aaed1c 100644 --- a/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp +++ b/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp @@ -1542,6 +1542,9 @@ void PCB_EASYEDAPRO_PARSER::ParseBoard( } } + if( deviceId.empty() ) + continue; + nlohmann::json compAttrs = aProject.at( "devices" ).at( deviceId ).at( "attributes" ); wxString fpId;