fix(as5600): check before delete
This commit is contained in:
parent
d2d51db455
commit
7a275e5d02
1 changed files with 6 additions and 2 deletions
|
|
@ -47,7 +47,12 @@ public:
|
|||
@brief Destructor for an AS5600 sensor.
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
~WipperSnapper_I2C_Driver_AS5600() { delete _as5600; }
|
||||
~WipperSnapper_I2C_Driver_AS5600() {
|
||||
if (_as5600) {
|
||||
delete _as5600;
|
||||
_as5600 = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
|
|
@ -129,7 +134,6 @@ public:
|
|||
*/
|
||||
/*******************************************************************************/
|
||||
bool getEventRaw(sensors_event_t *rawEvent) {
|
||||
ulong start = millis();
|
||||
if (!readSensor()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue