Eeschema, fields_grid_table.cpp: fix a crash when the eeschema settings are not available.

It happens if the svhematic is not open when opening the symbol editor.
Fix also a compil warning.

Fixes #6384
https://gitlab.com/kicad/code/kicad/issues/6384
This commit is contained in:
jean-pierre charras 2020-11-15 13:50:10 +01:00
parent 8a4992b528
commit 9aa6e40b79
2 changed files with 6 additions and 1 deletions

View File

@ -309,7 +309,9 @@ wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAtt
wxString fn = GetValue( aRow, FDC_NAME );
SCHEMATIC_SETTINGS* settings = m_frame->Prj().GetProjectFile().m_SchematicSettings;
const TEMPLATE_FIELDNAME* templateFn = settings->m_TemplateFieldNames.GetFieldName( fn );
const TEMPLATE_FIELDNAME* templateFn =
settings ? settings->m_TemplateFieldNames.GetFieldName( fn ) : nullptr;
if( templateFn && templateFn->m_URL )
{

View File

@ -106,6 +106,9 @@ public:
case S_ARC:
case S_CURVE:
return false;
case S_LAST: // Sentinel
break;
}
return false; // Make compil happy