C++: Fix null pointer dereference

Task-number: QTCREATORBUG-8698

Change-Id: If3181cb923ef7249945908c0610c16952262e881
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-02-06 14:32:56 +01:00
parent a7d2e3c729
commit 4e35683e53

View File

@@ -79,5 +79,11 @@ bool Name::Compare::operator()(const Name *name, const Name *other) const
const Identifier *id = name->identifier(); const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier(); const Identifier *otherId = other->identifier();
if (id == 0)
return otherId != 0;
if (otherId == 0)
return false;
return std::strcmp(id->chars(), otherId->chars()) < 0; return std::strcmp(id->chars(), otherId->chars()) < 0;
} }