From 984f1dbe26a6e9b353db64cdf837708b5575a764 Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Tue, 28 Nov 2023 13:10:34 +0100 Subject: [PATCH] modbus_tcp checking if ext is null but not utilising it to skip over the strcmp's --- project/Core/Src/modbus_tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/project/Core/Src/modbus_tcp.c b/project/Core/Src/modbus_tcp.c index c8c0941..582571a 100644 --- a/project/Core/Src/modbus_tcp.c +++ b/project/Core/Src/modbus_tcp.c @@ -109,8 +109,7 @@ static err_t modbus_incoming_data(void* arg, struct tcp_pcb* pcb, struct pbuf* p const char* ext = strrchr(file_list[registers[REG_IMAGE_NR] - 1].name, '.'); if (ext == NULL) { LOG_CRIT(TAG, "No valid extension found"); - } - if (strcmp(ext, ".gif") == 0) { + } else if (strcmp(ext, ".gif") == 0) { lcd_draw_gif_from_fs(file_list[registers[REG_IMAGE_NR] - 1].name, 0, 75); } else if (strcmp(ext, ".bmp") == 0) { lcd_draw_img_from_fs(file_list[registers[REG_IMAGE_NR] - 1].name, 0, 75);