summaryrefslogtreecommitdiff
path: root/src/event.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-12 18:29:12 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-13 04:41:55 +0300
commit6bd4fff31e0b44b8b71876250c626fe8c15b4105 (patch)
treecdd7f984a0850864316ae23c33120b6d282b70ba /src/event.cpp
parentf457675ecfd704c99e84fe14f0a1dd49a69a9c76 (diff)
downloadmv-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.gz
mv-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.bz2
mv-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.xz
mv-6bd4fff31e0b44b8b71876250c626fe8c15b4105.zip
Add missing checks to some files and style fixes.
Diffstat (limited to 'src/event.cpp')
-rw-r--r--src/event.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 5a1d673b2..6913e8660 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -56,7 +56,7 @@ int Event::getInt(const std::string &key) const throw (BadEvent)
if (it == mData.end())
throw BAD_KEY;
- if (it->second->getType() != VariableData::DATA_INT)
+ if (!it->second || it->second->getType() != VariableData::DATA_INT)
throw BAD_VALUE;
return static_cast<IntData *>(it->second)->getData();
@@ -78,7 +78,7 @@ const std::string &Event::getString(const std::string &key)
if (it == mData.end())
throw BAD_KEY;
- if (it->second->getType() != VariableData::DATA_STRING)
+ if (!! it->second || it->second->getType() != VariableData::DATA_STRING)
throw BAD_VALUE;
return static_cast<StringData *>(it->second)->getData();
@@ -99,7 +99,7 @@ double Event::getFloat(const std::string &key) const throw (BadEvent)
if (it == mData.end())
throw BAD_KEY;
- if (it->second->getType() != VariableData::DATA_FLOAT)
+ if (!it->second || it->second->getType() != VariableData::DATA_FLOAT)
throw BAD_VALUE;
return static_cast<FloatData *>(it->second)->getData();