forked from qt-creator/qt-creator
Core::Id: Handle empty strings passed to fromString()
Return Id() in that case. Currently we can convert the invalid Id to a string, but when we try to convert that string back to an Id there is a soft assert. Change-Id: Iad8443ff65a643030bd47446ec2dcf2889d2e4eb Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -201,6 +201,8 @@ QString Id::toString() const
|
|||||||
|
|
||||||
Id Id::fromString(const QString &name)
|
Id Id::fromString(const QString &name)
|
||||||
{
|
{
|
||||||
|
if (name.isEmpty())
|
||||||
|
return Id();
|
||||||
return Id(theId(name.toUtf8()));
|
return Id(theId(name.toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user