Skip to content

Commit

Permalink
Fix static analyzer warning in checkSensorButtonEvent()
Browse files Browse the repository at this point in the history
In theory item pointer should never be null, the explicit check prevents false positive warnings for clang scan-build.
  • Loading branch information
manup committed May 9, 2021
1 parent 066192b commit 7304060
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4252,7 +4252,6 @@ void DeRestPluginPrivate::checkSensorButtonEvent(Sensor *sensor, const deCONZ::A

if (ind.dstAddressMode() == deCONZ::ApsGroupAddress && ind.dstAddress().group() != 0)
{
QStringList gids;
ResourceItem *item = sensor->addItem(DataTypeString, RConfigGroup);

quint16 groupId = ind.dstAddress().group();
Expand All @@ -4272,18 +4271,19 @@ void DeRestPluginPrivate::checkSensorButtonEvent(Sensor *sensor, const deCONZ::A
}
}

QString gid = QString::number(groupId);
QStringList gids;
const QString gid = QString::number(groupId);

if (item)
{
gids = item->toString().split(',');
}

if (sensor->manufacturer() == QLatin1String("ubisys"))
if (!item) // should always be non null, this check is here to keep static analizer happy
{
// TODO

}
if (sensor->modelId().startsWith(QLatin1String("RC 110"))) // innr remote
else if (sensor->modelId().startsWith(QLatin1String("RC 110"))) // innr remote
{
// 7 controller endpoints: 0x01, 0x03, 0x04, ..., 0x08
if (gids.length() != 7)
Expand Down

0 comments on commit 7304060

Please sign in to comment.