diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-20 09:09:32 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-20 09:09:32 +0000 |
commit | 298916773ff3b80112cbac6c2ff6d41e7e280db1 (patch) | |
tree | a4162bd1db097c74e7a2d9242095c4e5032e457e | |
parent | 71b183077492e4f9e78bb09d1f1c55d98f60c416 (diff) | |
download | manaserv-298916773ff3b80112cbac6c2ff6d41e7e280db1.tar.gz manaserv-298916773ff3b80112cbac6c2ff6d41e7e280db1.tar.bz2 manaserv-298916773ff3b80112cbac6c2ff6d41e7e280db1.tar.xz manaserv-298916773ff3b80112cbac6c2ff6d41e7e280db1.zip |
Prevented access to uninitialized engines.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/scripting/script.cpp | 13 |
2 files changed, 12 insertions, 5 deletions
@@ -1,3 +1,7 @@ +2007-08-20 Guillaume Melquiond <guillaume.melquiond@gmail.com> + + * src/scripting/script.cpp: Prevented access to uninitialized engines. + 2007-08-19 Guillaume Melquiond <guillaume.melquiond@gmail.com> * src/account-server/accounthandler.cpp, src/defines.h: Fixed typos. diff --git a/src/scripting/script.cpp b/src/scripting/script.cpp index 3e19305d..9666b213 100644 --- a/src/scripting/script.cpp +++ b/src/scripting/script.cpp @@ -47,13 +47,16 @@ void Script::registerEngine(std::string const &name, Factory f) Script *Script::create(std::string const &engine) { - Engines::const_iterator i = engines->find(engine); - if (i == engines->end()) + if (engines) { - LOG_ERROR("No scripting engine named " << engine); - return NULL; + Engines::const_iterator i = engines->find(engine); + if (i != engines->end()) + { + return i->second(); + } } - return i->second(); + LOG_ERROR("No scripting engine named " << engine); + return NULL; } void Script::update() |