don't segfault due to null pointer when handling dispersive materials (Lorentz/Debye). if(prop==NULL) continue;

pull/40/head
radioactive 2018-09-13 23:21:16 -07:00
parent cc5a709e74
commit 3a2af34bce
1 changed files with 6 additions and 0 deletions

View File

@ -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,(CSProperties::PropertyType)(CSProperties::METAL | CSProperties::MATERIAL), true);
CSProperties* prop = m_Op->GetGeometryCSX()->GetPropertyByCoordPriority(coord, vPrims, true); CSProperties* prop = m_Op->GetGeometryCSX()->GetPropertyByCoordPriority(coord, vPrims, true);
if(prop==NULL) continue;
if ((mat = prop->ToLorentzMaterial())) if ((mat = prop->ToLorentzMaterial()))
{ {
w_plasma = mat->GetEpsPlasmaFreqWeighted(order,n,coord) * 2 * PI; 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,(CSProperties::PropertyType)(CSProperties::METAL | CSProperties::MATERIAL), true);
CSProperties* prop = m_Op->GetGeometryCSX()->GetPropertyByCoordPriority(coord, vPrims, true); CSProperties* prop = m_Op->GetGeometryCSX()->GetPropertyByCoordPriority(coord, vPrims, true);
if(prop==NULL) continue;
if ((mat = prop->ToLorentzMaterial())) if ((mat = prop->ToLorentzMaterial()))
{ {
w_plasma = mat->GetMuePlasmaFreqWeighted(order,n,coord) * 2 * PI; w_plasma = mat->GetMuePlasmaFreqWeighted(order,n,coord) * 2 * PI;