Skip to content

Commit

Permalink
Avoid dereferencing non-blob value
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Jan 22, 2024
1 parent 32ec086 commit 5233a06
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions libraries/YarpPlugins/CanBusBroker/DeviceDriverImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,14 @@ bool CanBusBroker::open(yarp::os::Searchable & config)

if (!syncThread->openPort("/sync:o"))
{
yCError(CBB) << "Unable to open sync port";
yCError(CBB) << "Unable to open synchronization port";
return false;
}

yarp::os::Value * obs;

if (config.check("syncObserver", obs, "synchronization signal observer"))
if (yarp::os::Value * v; config.check("syncObserver", v, "synchronization signal observer") && v->isBlob())
{
auto * observer = *reinterpret_cast<TypedStateObserver<double> * const *>(obs->asBlob());
yCDebug(CBB) << "Setting synchronization signal observer";
auto * observer = *reinterpret_cast<TypedStateObserver<double> * const *>(v->asBlob());
syncThread->setObserver(observer);
}
}
Expand Down

0 comments on commit 5233a06

Please sign in to comment.