delete works for nullptr, no need to set a member in the destructor

This commit is contained in:
Christian Riggenbach 2022-04-17 14:35:09 +02:00
parent 1c1c73ee85
commit 3561fd9ff6

View file

@ -75,12 +75,7 @@ Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, int8_t sckpin,
/*!
* @brief Release memory allocated in constructors
*/
Adafruit_SPIDevice::~Adafruit_SPIDevice() {
if (_spiSetting) {
delete _spiSetting;
_spiSetting = nullptr;
}
}
Adafruit_SPIDevice::~Adafruit_SPIDevice() { delete _spiSetting; }
/*!
* @brief Initializes SPI bus and sets CS pin high