Print a better warning when setStateValue() is called with a wrong name
This commit is contained in:
parent
45081ad64e
commit
48095b2ced
@ -423,6 +423,11 @@ void Thing::setStateValue(const StateTypeId &stateTypeId, const QVariant &value)
|
|||||||
void Thing::setStateValue(const QString &stateName, const QVariant &value)
|
void Thing::setStateValue(const QString &stateName, const QVariant &value)
|
||||||
{
|
{
|
||||||
StateTypeId stateTypeId = m_thingClass.stateTypes().findByName(stateName).id();
|
StateTypeId stateTypeId = m_thingClass.stateTypes().findByName(stateName).id();
|
||||||
|
if (stateTypeId.isNull()) {
|
||||||
|
qCWarning(dcThing()) << "No such state" << stateName << "in" << m_name << "(" + thingClass().name() + ")";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setStateValue(stateTypeId, value);
|
setStateValue(stateTypeId, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user