Eeschema: add defensive code to symbol library cache I/O.

This commit is contained in:
Wayne Stambaugh 2020-12-09 11:46:10 -05:00
parent e0fb12488b
commit e61f768fbc
1 changed files with 8 additions and 0 deletions

View File

@ -1442,6 +1442,10 @@ void SCH_SEXPR_PLUGIN_CACHE::Load()
wxString::Format( "Cannot use relative file paths in sexpr plugin to "
"open library \"%s\".", m_libFileName.GetFullPath() ) );
// The current locale must use period as the decimal point.
wxCHECK2( wxLocale::GetInfo( wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER ) == ".",
LOCALE_IO toggle );
wxLogTrace( traceSchLegacyPlugin, "Loading sexpr symbol library file \"%s\"",
m_libFileName.GetFullPath() );
@ -1511,6 +1515,10 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFo
{
wxCHECK_RET( aSymbol, "Invalid LIB_PART pointer." );
// The current locale must use period as the decimal point.
wxCHECK2( wxLocale::GetInfo( wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER ) == ".",
LOCALE_IO toggle );
int lastFieldId;
LIB_FIELDS fields;
std::string name = aFormatter.Quotew( aSymbol->GetLibId().Format().wx_str() );