From 7eea6e7c69ce71e69492330a4ff1cf09df9f39f2 Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Sat, 8 Dec 2012 20:44:59 -0800 Subject: ICE-5120 - assertion error in C++ marshaling code --- cpp/src/Slice/CPlusPlusUtil.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp') diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 403fc9b15b5..6aa2416f3f3 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -222,16 +222,30 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string& out << nl << "if(___" << fixedName << ")"; out << sb; out << nl << fixedName << ".__setIsSet();"; + out << nl << "if(!___" << fixedName << "->empty())"; + out << sb; out << nl << fixedName << "->first" << " = &(*___" << fixedName << ")[0];"; out << nl << fixedName << "->second" << " = " << fixedName << "->first + " << "___" << fixedName << "->size();"; out << eb; + out << nl << "else"; + out << sb; + out << nl << fixedName << "->first" << " = " << fixedName << "->second" << " = 0;"; + out << eb; + out << eb; } else { + out << nl << "if(!___" << fixedName << ".empty())"; + out << sb; out << nl << fixedName << ".first" << " = &___" << fixedName << "[0];"; out << nl << fixedName << ".second" << " = " << fixedName << ".first + " << "___" << fixedName << ".size();"; + out << eb; + out << nl << "else"; + out << sb; + out << nl << fixedName << ".first" << " = " << fixedName << ".second" << " = 0;"; + out << eb; } } } -- cgit v1.2.3