forked from qt-creator/qt-creator
Core::Id: Fix possible crash in operator ==
Revert a workaround applied earlier Change-Id: I825bdf6df662a5509166b9b7d12a4fb305cba6cd Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
04db5c4479
commit
4e5e6b45fe
@@ -89,7 +89,7 @@ public:
|
|||||||
static bool operator==(const StringHolder &sh1, const StringHolder &sh2)
|
static bool operator==(const StringHolder &sh1, const StringHolder &sh2)
|
||||||
{
|
{
|
||||||
// sh.n is unlikely to discriminate better than the hash.
|
// sh.n is unlikely to discriminate better than the hash.
|
||||||
return sh1.h == sh2.h && strcmp(sh1.str, sh1.str) == 0;
|
return sh1.h == sh2.h && sh1.str && sh2.str && strcmp(sh1.str, sh2.str) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -314,7 +314,11 @@ void Id::registerId(int uid, const char *name)
|
|||||||
|
|
||||||
bool Id::operator==(const char *name) const
|
bool Id::operator==(const char *name) const
|
||||||
{
|
{
|
||||||
return strcmp(stringFromId.value(m_id).str, name) == 0;
|
const char *string = stringFromId.value(m_id).str;
|
||||||
|
if (string && name)
|
||||||
|
return strcmp(string, name) == 0;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For debugging purposes
|
// For debugging purposes
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ CustomExecutableRunConfigurationFactory::~CustomExecutableRunConfigurationFactor
|
|||||||
bool CustomExecutableRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
|
bool CustomExecutableRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
|
||||||
const Core::Id id) const
|
const Core::Id id) const
|
||||||
{
|
{
|
||||||
if (!canHandle(parent) || !id.isValid())
|
if (!canHandle(parent))
|
||||||
return false;
|
return false;
|
||||||
return id == CUSTOM_EXECUTABLE_ID;
|
return id == CUSTOM_EXECUTABLE_ID;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user