Commit 731228d1 authored by Bodmer's avatar Bodmer

Fix deleteSprite

Fixes #736 and also delete color map even if the sprite has not been created.
parent 1c66d306
...@@ -125,7 +125,7 @@ void* TFT_eSprite::getPointer(void) ...@@ -125,7 +125,7 @@ void* TFT_eSprite::getPointer(void)
/*************************************************************************************** /***************************************************************************************
** Function name: created ** Function name: created
** Description: Returns true is sprite has been created ** Description: Returns true if sprite has been created
***************************************************************************************/ ***************************************************************************************/
bool TFT_eSprite::created(void) bool TFT_eSprite::created(void)
{ {
...@@ -376,18 +376,18 @@ uint16_t TFT_eSprite::getPaletteColor(uint8_t index) ...@@ -376,18 +376,18 @@ uint16_t TFT_eSprite::getPaletteColor(uint8_t index)
***************************************************************************************/ ***************************************************************************************/
void TFT_eSprite::deleteSprite(void) void TFT_eSprite::deleteSprite(void)
{ {
if (!_created ) return;
if (_colorMap != nullptr) if (_colorMap != nullptr)
{ {
free(_colorMap); free(_colorMap);
_colorMap = nullptr;
} }
if (_created)
{
free(_img8_1); free(_img8_1);
_img8 = nullptr; _img8 = nullptr;
_created = false; _created = false;
}
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_ #ifndef _TFT_eSPIH_
#define _TFT_eSPIH_ #define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.2.18" #define TFT_ESPI_VERSION "2.2.19"
/*************************************************************************************** /***************************************************************************************
** Section 1: Load required header files ** Section 1: Load required header files
......
{ {
"name": "TFT_eSPI", "name": "TFT_eSPI",
"version": "2.2.18", "version": "2.2.19",
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140", "keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32", "description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
"repository": "repository":
......
name=TFT_eSPI name=TFT_eSPI
version=2.2.18 version=2.2.19
author=Bodmer author=Bodmer
maintainer=Bodmer maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32 sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment