aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-04-16 10:34:15 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-04-16 10:36:43 -0700
commit631581a70eb9f8f36c3a6b5e55f4ec223f85301e (patch)
treebed020ed43899570962ea4c9cea68373da95ea5b /src/core
parent19b4b8e47145fa611f8022eb35d1d31f4b8f96a1 (diff)
Be more gently with NULL values
Diffstat (limited to 'src/core')
-rw-r--r--src/core/basetypes/MCHashMap.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/basetypes/MCHashMap.cpp b/src/core/basetypes/MCHashMap.cpp
index 9958c502..940515bc 100644
--- a/src/core/basetypes/MCHashMap.cpp
+++ b/src/core/basetypes/MCHashMap.cpp
@@ -203,6 +203,10 @@ Object * HashMap::objectForKey(Object * key)
{
unsigned int func;
HashMapIter * iter;
+
+ if (key == NULL) {
+ return NULL;
+ }
func = key->hash();
@@ -289,6 +293,9 @@ void HashMap::removeAllObjects()
bool HashMap::isEqual(Object * otherObject)
{
HashMap * otherMap = (HashMap *) otherObject;
+ if (otherMap == NULL) {
+ return false;
+ }
if (otherMap->count() != count()) {
return false;
}