From f2d81746a7c00ffb249defaf9e6db40003c4a401 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 10 May 2024 18:37:05 +0200 Subject: [PATCH] fixed crash on adding/deleting colors to colortables --- config.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config.cpp b/config.cpp index 3e10481b..e2236c29 100644 --- a/config.cpp +++ b/config.cpp @@ -3486,8 +3486,8 @@ EX void edit_color_table(colortable& ct, const reaction_t& r IS(reaction_t()), b ct[i] ^= 0x1000000; if(!(ct[i] & 0x1000000)) return; } - dialog::openColorDialog(ct[i]); - dialog::get_di().reaction = r; + dialog::openColorDialog(ct[i]); + if(r) dialog::get_di().reaction = r; dialog::colorAlpha = false; dialog::get_di().dialogflags |= sm::SIDE; }); @@ -3496,14 +3496,14 @@ EX void edit_color_table(colortable& ct, const reaction_t& r IS(reaction_t()), b dialog::addItem("add a color", 'A'); dialog::add_action([&ct, r] { ct.push_back(rand() & 0x1FFFFFF); - r(); + if(r) r(); }); if(isize(ct) > 2) { dialog::addItem("delete a color", 'D'); dialog::add_action([&ct, r] { ct.pop_back(); - r(); + if(r) r(); }); }