diff --git a/Adafruit_BMP280.cpp b/Adafruit_BMP280.cpp index 3ffb707..0994325 100644 --- a/Adafruit_BMP280.cpp +++ b/Adafruit_BMP280.cpp @@ -37,8 +37,10 @@ Adafruit_BMP280::~Adafruit_BMP280(void) { delete spi_dev; if (i2c_dev) delete i2c_dev; - delete temp_sensor; - delete pressure_sensor; + if (temp_sensor == nullptr) + delete temp_sensor; + if (pressure_sensor == nullptr) + delete pressure_sensor; } /*!