From 74445c0aaa980f2afa508125d9aa3ab6bb39ef46 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 21 May 2021 09:02:24 +0200 Subject: [PATCH] LVGL fix crash in file system --- lib/libesp32_lvgl/LVGL/src/lv_misc/lv_fs.c | 4 +++- tasmota/xdrv_54_lvgl.ino | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libesp32_lvgl/LVGL/src/lv_misc/lv_fs.c b/lib/libesp32_lvgl/LVGL/src/lv_misc/lv_fs.c index 6f66c765d..b7809d138 100644 --- a/lib/libesp32_lvgl/LVGL/src/lv_misc/lv_fs.c +++ b/lib/libesp32_lvgl/LVGL/src/lv_misc/lv_fs.c @@ -148,7 +148,9 @@ lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p) lv_fs_res_t res = file_p->drv->close_cb(file_p->drv, file_p->file_d); - lv_mem_free(file_p->file_d); /*Clean up*/ + if(file_p->drv->file_size != 0) { /*Is file_d zero size?*/ + lv_mem_free(file_p->file_d); /*Clean up*/ + } file_p->file_d = NULL; file_p->drv = NULL; diff --git a/tasmota/xdrv_54_lvgl.ino b/tasmota/xdrv_54_lvgl.ino index f52de88fe..24e0321af 100644 --- a/tasmota/xdrv_54_lvgl.ino +++ b/tasmota/xdrv_54_lvgl.ino @@ -219,7 +219,6 @@ static lv_fs_res_t lvbe_fs_open(lv_fs_drv_t * drv, void * file_p, const char * p // AddLog(LOG_LEVEL_INFO, "LVG: F=%*_H", sizeof(f), &f); if (f) { File * f_ptr = new File(f); // copy to dynamic object - *f_ptr = f; // TODO is this necessary? *((File**)file_p) = f_ptr; return LV_FS_RES_OK; } else {