From a5eff41eccca6a72b6037b19f06eeb1cf223ddaa Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 6 Jun 2001 14:17:03 +0000 Subject: [PATCH] fix unnamed type bug --- dtool/src/interrogate/interrogateBuilder.cxx | 5 +++++ dtool/src/interrogatedb/interrogateDatabase.cxx | 3 +++ 2 files changed, 8 insertions(+) diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index d10c1e96c4..ad4e25b8ab 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1777,6 +1777,11 @@ get_type(CPPType *type, bool global) { if (tni != _types_by_name.end()) { // It's already here, so update the global flag. index = (*tni).second; + if (index == 0) { + // This is an invalid type; we don't know anything about it. + return 0; + } + InterrogateType &itype = InterrogateDatabase::get_ptr()->update_type(index); if (global) { itype._flags |= InterrogateType::F_global; diff --git a/dtool/src/interrogatedb/interrogateDatabase.cxx b/dtool/src/interrogatedb/interrogateDatabase.cxx index b9b6a7bd47..f6de845733 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.cxx +++ b/dtool/src/interrogatedb/interrogateDatabase.cxx @@ -501,6 +501,7 @@ get_next_index() { //////////////////////////////////////////////////////////////////// void InterrogateDatabase:: add_type(TypeIndex index, const InterrogateType &type) { + assert(index != 0); bool inserted = _type_map.insert(TypeMap::value_type(index, type)).second; @@ -593,6 +594,7 @@ add_element(ElementIndex index, const InterrogateElement &element) { //////////////////////////////////////////////////////////////////// InterrogateType &InterrogateDatabase:: update_type(TypeIndex type) { + assert(type != 0); check_latest(); return _type_map[type]; } @@ -697,6 +699,7 @@ remap_indices(int first_index, IndexRemapper &remap) { TypeMap new_type_map; TypeMap::iterator ti; for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { + assert((*ti).first != 0); remap.add_mapping((*ti).first, first_index); new_type_map[first_index] = (*ti).second; first_index++;