From e998e9fdfd6328ec7552fc291e2ab48ec6eba301 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 26 Mar 2019 07:59:44 +0100 Subject: [PATCH] STYLE: avoid nullptr when writing fan RPM --- .../swirlFanVelocity/swirlFanVelocityFvPatchField.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.C index 3d0c0f9fd2..ede79590bf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.C @@ -107,7 +107,6 @@ void Foam::swirlFanVelocityFvPatchField::calcFanJump() } - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField @@ -156,7 +155,6 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField this->cyclicPatch().owner() ? Function1::New("rpm", dict) : nullptr - ), rEff_(dict.lookupOrDefault("rEff", 0)), fanEff_(dict.lookupOrDefault("fanEff", 1)), @@ -248,7 +246,11 @@ void Foam::swirlFanVelocityFvPatchField::write(Ostream& os) const os.writeEntryIfDifferent("p", "p", pName_); os.writeEntryIfDifferent("rho", "rho", rhoName_); os.writeEntry("origin", origin_); - rpm_->writeData(os); + + if (rpm_) + { + rpm_->writeData(os); + } os.writeEntryIfDifferent("rEff", 0.0, rEff_); os.writeEntryIfDifferent("useRealRadius", false, useRealRadius_);