diff --git a/src/shared/cplusplus/TypeMatcher.cpp b/src/shared/cplusplus/TypeMatcher.cpp
index a03ac98afeb3000682b258d2942dfeb51c5878f8..599ca60298f7869617469efb06e926176967bb51 100644
--- a/src/shared/cplusplus/TypeMatcher.cpp
+++ b/src/shared/cplusplus/TypeMatcher.cpp
@@ -45,8 +45,11 @@ TypeMatcher::~TypeMatcher()
 
 bool TypeMatcher::isEqualTo(const Name *name, const Name *otherName) const
 {
-    if (! name || ! otherName)
-        return name == otherName;
+    if (name == otherName)
+        return true;
+
+    else if (! name || ! otherName)
+        return false;
 
     return name->isEqualTo(otherName);
 }