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
1 changed files with 1 additions and 6 deletions

View File

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