Skip to content

Commit 3561fd9

Browse files
committed
delete works for nullptr, no need to set a member in the destructor
1 parent 1c1c73e commit 3561fd9

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Adafruit_SPIDevice.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,7 @@ Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, int8_t sckpin,
7575
/*!
7676
* @brief Release memory allocated in constructors
7777
*/
78-
Adafruit_SPIDevice::~Adafruit_SPIDevice() {
79-
if (_spiSetting) {
80-
delete _spiSetting;
81-
_spiSetting = nullptr;
82-
}
83-
}
78+
Adafruit_SPIDevice::~Adafruit_SPIDevice() { delete _spiSetting; }
8479

8580
/*!
8681
* @brief Initializes SPI bus and sets CS pin high

0 commit comments

Comments
 (0)