From 3561fd9ff64b1d3dbf7d42d8031659ae51163ea8 Mon Sep 17 00:00:00 2001 From: Christian Riggenbach Date: Sun, 17 Apr 2022 14:35:09 +0200 Subject: [PATCH] delete works for nullptr, no need to set a member in the destructor --- Adafruit_SPIDevice.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Adafruit_SPIDevice.cpp b/Adafruit_SPIDevice.cpp index 55298f7..d438e67 100644 --- a/Adafruit_SPIDevice.cpp +++ b/Adafruit_SPIDevice.cpp @@ -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