Handle possible null in dynamic_cast

This commit is contained in:
Seth Hillbrand 2022-11-30 12:30:49 -08:00
parent b31349b679
commit ce63c37bfd
1 changed files with 10 additions and 1 deletions

View File

@ -97,6 +97,9 @@ int EESCHEMA_JOBS_HANDLER::JobExportPdf( JOB* aJob )
{
JOB_EXPORT_SCH_PDF* aPdfJob = dynamic_cast<JOB_EXPORT_SCH_PDF*>( aJob );
if( !aPdfJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aPdfJob->m_filename, SCH_IO_MGR::SCH_KICAD );
if( sch == nullptr )
@ -130,6 +133,9 @@ int EESCHEMA_JOBS_HANDLER::JobExportSvg( JOB* aJob )
{
JOB_EXPORT_SCH_SVG* aSvgJob = dynamic_cast<JOB_EXPORT_SCH_SVG*>( aJob );
if( !aSvgJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aSvgJob->m_filename, SCH_IO_MGR::SCH_KICAD );
if( sch == nullptr )
@ -163,6 +169,9 @@ int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob )
{
JOB_EXPORT_SCH_NETLIST* aNetJob = dynamic_cast<JOB_EXPORT_SCH_NETLIST*>( aJob );
if( !aNetJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aNetJob->m_filename, SCH_IO_MGR::SCH_KICAD );
if( sch == nullptr )
@ -358,4 +367,4 @@ int EESCHEMA_JOBS_HANDLER::JobExportSymLibUpgrade( JOB* aJob )
}
return CLI::EXIT_CODES::OK;
}
}