From 6ebd6d64cf94d94dfc6dc47311536d4585d71b6a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 14 Apr 2024 09:48:23 -0700 Subject: [PATCH] SHOW: Fix crash in SHOW TITLE and SHOW SUBTITLE if there is no (sub)title. Thanks to Zhou Geng for reporting this bug as poc14 in the report here: https://lists.gnu.org/archive/html/bug-gnu-pspp/2024-03/msg00015.html --- src/language/commands/set.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/language/commands/set.c b/src/language/commands/set.c index c1792337b8..bca5521f4d 100644 --- a/src/language/commands/set.c +++ b/src/language/commands/set.c @@ -1028,7 +1028,7 @@ show_SPLIT (const struct dataset *ds) static char * show_SUBTITLE (const struct dataset *ds UNUSED) { - return xstrdup (output_get_subtitle ()); + return xstrdup_if_nonnull (output_get_subtitle ()); } static char * @@ -1040,7 +1040,7 @@ show_TEMPDIR (const struct dataset *ds UNUSED) static char * show_TITLE (const struct dataset *ds UNUSED) { - return xstrdup (output_get_title ()); + return xstrdup_if_nonnull (output_get_title ()); } static bool -- 2.30.2