Catch memory exhaustion trying to import large DXFs

See https://gitlab.com/kicad/code/kicad/-/issues/11308


(cherry picked from commit 9f8c0a8185)
This commit is contained in:
Marek Roszko 2022-04-01 23:13:38 -04:00 committed by Mark Roszko
parent 6706a5c462
commit d5de4bb5c7
1 changed files with 9 additions and 1 deletions

View File

@ -118,7 +118,15 @@ DXF_IMPORT_PLUGIN::~DXF_IMPORT_PLUGIN()
bool DXF_IMPORT_PLUGIN::Load( const wxString& aFileName )
{
return ImportDxfFile( aFileName );
try
{
return ImportDxfFile( aFileName );
}
catch( const std::bad_alloc& )
{
reportMsg( _( "Memory was exhausted trying to load the DXF, it may be too large." ) );
return false;
}
}