From 52bea2e3c5f8ba100247b4c3db153ec8cffd71f7 Mon Sep 17 00:00:00 2001 From: PoliEcho Date: Tue, 1 Apr 2025 09:32:38 +0200 Subject: [PATCH] fix SEGFAULT when nullptr --- src/const.h | 2 +- src/memory.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/const.h b/src/const.h index c82f61f..a67c583 100644 --- a/src/const.h +++ b/src/const.h @@ -1,7 +1,7 @@ #include #ifndef VERSION -#define VERSION "0.7.1" +#define VERSION "0.7.2" #define NAME "bakatui" inline constexpr auto hash_djb2a(const std::string_view sv) { diff --git a/src/memory.cpp b/src/memory.cpp index f3312a1..ec0e14d 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -5,6 +5,9 @@ #include void delete_all(std::vector *allocated) { + if (allocated == nullptr) { + return; + } for (long long i = allocated->size() - 1; i >= 0; i--) { switch (allocated->at(i).type) { case WINDOW_ARRAY: {