summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/PythonUtil.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-02-05 14:08:24 +0100
committerJose <jose@zeroc.com>2019-02-05 14:10:12 +0100
commitf4f1c45b1fe339a72b10454d5d8d4de05a4ca7d4 (patch)
tree11ea8c3e6bc920cf5bb4d1a8db2793b260a8e05f /cpp/src/Slice/PythonUtil.cpp
parentAllow components to set properties for testing (diff)
downloadice-f4f1c45b1fe339a72b10454d5d8d4de05a4ca7d4.tar.bz2
ice-f4f1c45b1fe339a72b10454d5d8d4de05a4ca7d4.tar.xz
ice-f4f1c45b1fe339a72b10454d5d8d4de05a4ca7d4.zip
Fix compiler crash if forward declared class has no definition
This affects slice2py and slice2php Slice compilers
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r--cpp/src/Slice/PythonUtil.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp
index 2637ca26321..8e95f47b753 100644
--- a/cpp/src/Slice/PythonUtil.cpp
+++ b/cpp/src/Slice/PythonUtil.cpp
@@ -427,7 +427,8 @@ Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
_out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.declareValue('" << scoped << "')";
}
- if(!p->isLocal() && (p->isInterface() || p->definition()->allOperations().size()))
+ ClassDefPtr def = p->definition();
+ if(!p->isLocal() && (p->isInterface() || (def && def->allOperations().size())))
{
_out << nl << "_M_" << getAbsolute(p, "_t_", "Disp") << " = IcePy.declareClass('" << scoped << "')";
_out << nl << "_M_" << getAbsolute(p, "_t_", "Prx") << " = IcePy.declareProxy('" << scoped << "')";
@@ -1826,7 +1827,7 @@ Slice::Python::CodeVisitor::writeType(const TypePtr& p)
if(prx)
{
ClassDefPtr def = prx->_class()->definition();
- if(def->isInterface() || def->allOperations().size() > 0)
+ if(def && (def->isInterface() || def->allOperations().size() > 0))
{
_out << "_M_" << getAbsolute(prx->_class(), "_t_", "Prx");
}