From b6f9009d28548365cae5847ac8a236182a724f05 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Tue, 20 May 2014 16:16:07 +0000 Subject: [PATCH] Fixed a bad bug in deepStdVectorPointerCopy --- include/cantera/base/utilities.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/cantera/base/utilities.h b/include/cantera/base/utilities.h index f6a3eba40..8506e1c27 100644 --- a/include/cantera/base/utilities.h +++ b/include/cantera/base/utilities.h @@ -667,13 +667,17 @@ template void deepStdVectorPointerCopy(const std::vector &fromVec, std::vector &toVec) { size_t is = toVec.size(); - for (size_t i = 0; i < is; is++) { + for (size_t i = 0; i < is; i++) { delete toVec[i]; } is = fromVec.size(); toVec.resize(is); - for (size_t i = 0; i < is; is++) { - toVec[i] = new D(*(fromVec[i])); + for (size_t i = 0; i < is; i++) { + if (fromVec[i]) { + toVec[i] = new D(*(fromVec[i])); + } else { + toVec[i] = 0; + } } }