From b7f842aaca542e98cd1ec12d4932b099d17286e6 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Aug 2018 12:22:29 +0200 Subject: [PATCH] add some missing pointer checks --- src/ASM/ASMs3DLag.C | 2 +- src/SIM/SIMinput.C | 2 +- src/Utility/Functions.C | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ASM/ASMs3DLag.C b/src/ASM/ASMs3DLag.C index 31c9ae87..74a32183 100644 --- a/src/ASM/ASMs3DLag.C +++ b/src/ASM/ASMs3DLag.C @@ -851,7 +851,7 @@ int ASMs3DLag::evalPoint (const double* xi, double* param, Vec3& X) const param[d] = (1.0-xi[d])*svol->startparam(d) + xi[d]*svol->endparam(d); else param[d] = xi[d]; - if (!this->getGridParameters(u[d],d,svol->order(d)-1)) return -3; + if (svol && !this->getGridParameters(u[d],d,svol->order(d)-1)) return -3; } // Search for the closest node diff --git a/src/SIM/SIMinput.C b/src/SIM/SIMinput.C index 65694512..dcbef825 100644 --- a/src/SIM/SIMinput.C +++ b/src/SIM/SIMinput.C @@ -1125,7 +1125,7 @@ bool SIMinput::refine (const LR::RefineData& prm, } // Single patch models only pass refinement call to the ASM level - if (myModel.size() == 1) + if (myModel.size() == 1 && pch) return (isRefined = pch->refine(prm,sol,fName)); if (!prm.errors.empty()) // refinement by true_beta diff --git a/src/Utility/Functions.C b/src/Utility/Functions.C index a8254f04..437caaf0 100644 --- a/src/Utility/Functions.C +++ b/src/Utility/Functions.C @@ -67,7 +67,10 @@ Real SineFunc::deriv (Real x) const Real ConstTimeFunc::evaluate (const Vec3& X) const { const Vec4* Xt = dynamic_cast(&X); - return (*tfunc)(Xt ? Xt->t : Real(0)); + if (Xt) + return (*tfunc)(Xt->t); + else + return (*tfunc)(Real(0)); }