diff --git a/src/serialize.cpp b/src/serialize.cpp index 570463dc3..1bb704b41 100644 --- a/src/serialize.cpp +++ b/src/serialize.cpp @@ -125,13 +125,14 @@ Type::Type(const Anope::string &n, unserialize_func f, Module *o) : name(n), un Type::~Type() { /* null the type of existing serializable objects of this type */ - for (std::list::iterator it = Serializable::SerializableItems->begin(); it != Serializable::SerializableItems->end(); ++it) - { - Serializable *s = *it; + if (Serializable::SerializableItems != NULL) + for (std::list::iterator it = Serializable::SerializableItems->begin(); it != Serializable::SerializableItems->end(); ++it) + { + Serializable *s = *it; - if (s->s_type == this) - s->s_type = NULL; - } + if (s->s_type == this) + s->s_type = NULL; + } std::vector::iterator it = std::find(TypeOrder.begin(), TypeOrder.end(), this->name); if (it != TypeOrder.end())