From 9aa6e40b7904de7233d63d516391d160ab279bea Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 15 Nov 2020 13:50:10 +0100 Subject: [PATCH] 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 --- eeschema/fields_grid_table.cpp | 4 +++- pcbnew/pcb_shape.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index 8731966d8f..a8cdd91f96 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -309,7 +309,9 @@ wxGridCellAttr* FIELDS_GRID_TABLE::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 ) { diff --git a/pcbnew/pcb_shape.h b/pcbnew/pcb_shape.h index f263ed2a9e..48c1a95f96 100644 --- a/pcbnew/pcb_shape.h +++ b/pcbnew/pcb_shape.h @@ -106,6 +106,9 @@ public: case S_ARC: case S_CURVE: return false; + + case S_LAST: // Sentinel + break; } return false; // Make compil happy