From f6506497251f82a6153e68f8de32813d374bcd36 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 27 Aug 2008 00:01:21 +0000 Subject: [PATCH] Fixed a segfault when supplied with a null pointer. --- Cantera/src/thermo/WaterProps.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Cantera/src/thermo/WaterProps.cpp b/Cantera/src/thermo/WaterProps.cpp index 65c8b7627..4c4e15f7e 100644 --- a/Cantera/src/thermo/WaterProps.cpp +++ b/Cantera/src/thermo/WaterProps.cpp @@ -44,8 +44,13 @@ namespace Cantera { m_waterIAPWS(0), m_own_sub(false) { - m_waterIAPWS = wptr->getWater(); - m_own_sub = false; + if (wptr) { + m_waterIAPWS = wptr->getWater(); + m_own_sub = false; + } else { + m_waterIAPWS = new WaterPropsIAPWS(); + m_own_sub = true; + } } /**