diff options
author | Jose <jose@zeroc.com> | 2019-02-05 14:08:24 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-02-05 14:10:12 +0100 |
commit | f4f1c45b1fe339a72b10454d5d8d4de05a4ca7d4 (patch) | |
tree | 11ea8c3e6bc920cf5bb4d1a8db2793b260a8e05f /cpp/src/slice2php/Main.cpp | |
parent | Allow components to set properties for testing (diff) | |
download | ice-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/slice2php/Main.cpp')
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index b5d354af1fb..f9b8d768aad 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -168,14 +168,15 @@ CodeVisitor::visitClassDecl(const ClassDeclPtr& p) _out << sp << nl << "global " << type << ';'; bool isInterface = p->isInterface(); - if(!p->isLocal() && (isInterface || p->definition()->allOperations().size() > 0)) + ClassDefPtr def = p->definition(); + if(!p->isLocal() && (isInterface || (def && def->allOperations().size() > 0))) { _out << nl << "global " << type << "Prx;"; } _out << nl << "if(!isset(" << type << "))"; _out << sb; _out << nl << type << " = IcePHP_declareClass('" << scoped << "');"; - if(!p->isLocal() && (isInterface || p->definition()->allOperations().size() > 0)) + if(!p->isLocal() && (isInterface || (def && def->allOperations().size() > 0))) { _out << nl << type << "Prx = IcePHP_declareProxy('" << scoped << "');"; } @@ -1233,7 +1234,7 @@ CodeVisitor::getType(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)) { return getTypeVar(prx->_class(), "Prx"); } |