From 3a2af34bcefa715ae0ecddd207997b39aa3c41a4 Mon Sep 17 00:00:00 2001 From: radioactive Date: Thu, 13 Sep 2018 23:21:16 -0700 Subject: [PATCH] don't segfault due to null pointer when handling dispersive materials (Lorentz/Debye). if(prop==NULL) continue; --- FDTD/extensions/operator_ext_lorentzmaterial.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/FDTD/extensions/operator_ext_lorentzmaterial.cpp b/FDTD/extensions/operator_ext_lorentzmaterial.cpp index 9f386fc..24d41dc 100644 --- a/FDTD/extensions/operator_ext_lorentzmaterial.cpp +++ b/FDTD/extensions/operator_ext_lorentzmaterial.cpp @@ -225,6 +225,9 @@ bool Operator_Ext_LorentzMaterial::BuildExtension() // CSProperties* prop = m_Op->GetGeometryCSX()->GetPropertyByCoordPriority(coord,(CSProperties::PropertyType)(CSProperties::METAL | CSProperties::MATERIAL), true); CSProperties* prop = m_Op->GetGeometryCSX()->GetPropertyByCoordPriority(coord, vPrims, true); + + if(prop==NULL) continue; + if ((mat = prop->ToLorentzMaterial())) { w_plasma = mat->GetEpsPlasmaFreqWeighted(order,n,coord) * 2 * PI; @@ -277,6 +280,9 @@ bool Operator_Ext_LorentzMaterial::BuildExtension() // CSProperties* prop = m_Op->GetGeometryCSX()->GetPropertyByCoordPriority(coord,(CSProperties::PropertyType)(CSProperties::METAL | CSProperties::MATERIAL), true); CSProperties* prop = m_Op->GetGeometryCSX()->GetPropertyByCoordPriority(coord, vPrims, true); + + if(prop==NULL) continue; + if ((mat = prop->ToLorentzMaterial())) { w_plasma = mat->GetMuePlasmaFreqWeighted(order,n,coord) * 2 * PI;