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:
Tobias Hunger
2015-12-04 12:36:54 +01:00
parent 03c07b80fd
commit fb99157abd

View File

@@ -201,6 +201,8 @@ QString Id::toString() const
Id Id::fromString(const QString &name)
{
if (name.isEmpty())
return Id();
return Id(theId(name.toUtf8()));
}