From 02e29cef8844ac35772ba3b71ad10dc21d015036 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 5 Dec 2022 16:43:33 +0200 Subject: [PATCH 40/40] Ruledit: Fix handling of empty effect comment See osdn #46202 Signed-off-by: Marko Lindqvist --- tools/ruledit/effect_edit.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/ruledit/effect_edit.cpp b/tools/ruledit/effect_edit.cpp index 287c360953..541205e23a 100644 --- a/tools/ruledit/effect_edit.cpp +++ b/tools/ruledit/effect_edit.cpp @@ -263,7 +263,12 @@ void effect_edit::fill_active() } else { mp_button->setText(NO_MULTIPLIER_NAME); } - comment->setText(selected->rulesave.comment); + + if (selected->rulesave.comment == NULL) { + comment->setText(""); + } else { + comment->setText(selected->rulesave.comment); + } } else { mp_button->setText(NO_MULTIPLIER_NAME); } @@ -387,6 +392,8 @@ void effect_edit::comment_given() if (!comment->text().isEmpty()) { selected->rulesave.comment = fc_strdup(comment->text().toUtf8()); + } else { + selected->rulesave.comment = NULL; } fill_active(); -- 2.35.1