From efc1585ae3d8784295c020f2c617aab2e2502551 Mon Sep 17 00:00:00 2001 From: Kontinuation Date: Sun, 18 May 2014 20:46:28 +0800 Subject: [PATCH] Make the copy assignment operator of Exception class exception safe --- Foundation/src/Exception.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Foundation/src/Exception.cpp b/Foundation/src/Exception.cpp index e203c1c04..959e10e17 100644 --- a/Foundation/src/Exception.cpp +++ b/Foundation/src/Exception.cpp @@ -65,9 +65,10 @@ Exception& Exception::operator = (const Exception& exc) { if (&exc != this) { + Exception *new_pNested = exc._pNested? exc._pNested->clone() : 0; delete _pNested; _msg = exc._msg; - _pNested = exc._pNested ? exc._pNested->clone() : 0; + _pNested = new_pNested; _code = exc._code; } return *this;