Skip to content

Commit 7a275e5

Browse files
committed
fix(as5600): check before delete
1 parent d2d51db commit 7a275e5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/i2c/drivers/WipperSnapper_I2C_Driver_AS5600.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ class WipperSnapper_I2C_Driver_AS5600 : public WipperSnapper_I2C_Driver {
4747
@brief Destructor for an AS5600 sensor.
4848
*/
4949
/*******************************************************************************/
50-
~WipperSnapper_I2C_Driver_AS5600() { delete _as5600; }
50+
~WipperSnapper_I2C_Driver_AS5600() {
51+
if (_as5600) {
52+
delete _as5600;
53+
_as5600 = nullptr;
54+
}
55+
}
5156

5257
/*******************************************************************************/
5358
/*!
@@ -129,7 +134,6 @@ class WipperSnapper_I2C_Driver_AS5600 : public WipperSnapper_I2C_Driver {
129134
*/
130135
/*******************************************************************************/
131136
bool getEventRaw(sensors_event_t *rawEvent) {
132-
ulong start = millis();
133137
if (!readSensor()) {
134138
return false;
135139
}

0 commit comments

Comments
 (0)