diff --git a/common/plugins/altium/altium_parser.cpp b/common/plugins/altium/altium_parser.cpp index b72d01e4a2..cd43ef42dd 100644 --- a/common/plugins/altium/altium_parser.cpp +++ b/common/plugins/altium/altium_parser.cpp @@ -83,12 +83,20 @@ std::map ALTIUM_PARSER::ReadProperties() std::map kv; uint32_t length = Read(); - if( length > GetRemainingBytes() || m_pos[length - 1] != '\0' ) + if( length > GetRemainingBytes() ) { m_error = true; return kv; } + // There is one case by kliment where Board6 ends with "|NEARDISTANCE=1000mi". + // Both the 'l' and the null-byte are missing, which looks like Altium swallowed two bytes. + if( m_pos[length - 1] != '\0' ) + { + wxLogError( "For Altium import, we assumes a null byte at the end of a list of properties. " + "Because this is missing, imported data might be malformed or missing." ); + } + //we use std::string because std::string can handle NULL-bytes //wxString would end the string at the first NULL-byte std::string str = std::string( m_pos, length - 1 );