diff options
author | Adam <Adam@anope.org> | 2014-06-28 23:14:48 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-06-28 23:15:59 -0400 |
commit | 07902c03fde41205e5366b852553f1c74c9746dd (patch) | |
tree | 524e110dca8e88878f9ca1e533ea04a91468dfe6 /src/serialize.cpp | |
parent | d9949320c79fc06a0a370b45d408bc4e0a447704 (diff) |
Check that the list of items isn't NULL when destructing types
Diffstat (limited to 'src/serialize.cpp')
-rw-r--r-- | src/serialize.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
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<Serializable *>::iterator it = Serializable::SerializableItems->begin(); it != Serializable::SerializableItems->end(); ++it) - { - Serializable *s = *it; - - if (s->s_type == this) - s->s_type = NULL; - } + if (Serializable::SerializableItems != NULL) + for (std::list<Serializable *>::iterator it = Serializable::SerializableItems->begin(); it != Serializable::SerializableItems->end(); ++it) + { + Serializable *s = *it; + + if (s->s_type == this) + s->s_type = NULL; + } std::vector<Anope::string>::iterator it = std::find(TypeOrder.begin(), TypeOrder.end(), this->name); if (it != TypeOrder.end()) |