summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 6a5de35ff21..97aebb857a4 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2446,7 +2446,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << scope << name << "Ptr* p = static_cast< " << scope << name << "Ptr*>(__addr);";
C << nl << "assert(p);";
C << nl << "*p = " << scope << name << "Ptr::dynamicCast(v);";
- C << nl << "assert(!v || *p);";
+ C << nl << "if(v && !*p)";
+ C << sb;
+ C << nl << "::Ice::NoObjectFactoryException e(__FILE__, __LINE__);";
+ C << nl << "e.type = " << scope << name << "::ice_staticId();";
+ C << nl << "throw e;";
+ C << eb;
C << eb;
C << sp;