diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-10 18:13:07 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-10 18:13:07 +0000 |
commit | b9fbf3621c2a3ee18dd9c575d086fc16905f4793 (patch) | |
tree | 9dee9fed35922d89975763a0b9e2cb4dc4e57018 | |
parent | 321fdf7a641ca75b4002c3a205f3858fd985e8b1 (diff) |
Properly set the resulting pointer to NULL when the object isnt found
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4292 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/base.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/include/base.h b/include/base.h index ac5fec63f..01b0e9ae1 100644 --- a/include/base.h +++ b/include/base.h @@ -5,7 +5,7 @@ * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. * E-mail: * <brain@chatspike.net> - * <Craig@chatspike.net> + * <Craig@chatspike.net> * * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see @@ -96,15 +96,16 @@ public: */ template<typename T> bool GetExt(const std::string &key, T* &p) { - ExtensibleStore::iterator iter = this->Extension_Items.find(key); - if(iter != this->Extension_Items.end()) - { + ExtensibleStore::iterator iter = this->Extension_Items.find(key); + if(iter != this->Extension_Items.end()) + { p = (T*)iter->second; - return true; - } - else - { - return false; + return true; + } + else + { + p = NULL; + return false; } } //char* GetExt(const std::string &key); |