diff --git a/sdk/openbr_plugin.cpp b/sdk/openbr_plugin.cpp index 20685c3..fb3d3c8 100644 --- a/sdk/openbr_plugin.cpp +++ b/sdk/openbr_plugin.cpp @@ -130,10 +130,17 @@ void File::set(const QString &key, const QVariant &value) { if (key == "Label") { bool ok = false; - if (value.canConvert(QVariant::Double)) + const QString valueString = value.toString(); + + /* We assume that if the value starts with '0' + then it was probably intended to to be a string UID + and that it's numerical value is not relevant. */ + if (value.canConvert(QVariant::Double) && + (!valueString.startsWith('0') || (valueString == "0"))) value.toFloat(&ok); - if (!ok && !Globals->classes.contains(value.toString())) - Globals->classes.insert(value.toString(), Globals->classes.size()); + + if (!ok && !Globals->classes.contains(valueString)) + Globals->classes.insert(valueString, Globals->classes.size()); } m_metadata.insert(key, value);