From a361607c95529f3b74e0d631e6b9a26321b989ac Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Tue, 29 Aug 2023 16:01:38 +0200 Subject: [PATCH] src/main: more user-friendly output when no slot is activated Instead of printing | Activated: null (null) which is not quite intuitive, print | Activated: none This also simplifies the logic a bit. Signed-off-by: Enrico Joerns --- src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 4886a0220..65cb20f31 100644 --- a/src/main.c +++ b/src/main.c @@ -1402,7 +1402,10 @@ static gchar* r_status_formatter_readable(RaucStatusPrint *status) g_string_append_printf(text, "Booted from: %s (%s)\n\n", bootedfrom ? bootedfrom->name : NULL, status->bootslot); g_string_append(text, "=== Bootloader ===\n"); - g_string_append_printf(text, "Activated: %s (%s)\n\n", status->primary ? status->primary->name : NULL, status->primary ? status->primary->bootname : NULL); + if (!status->primary) + g_string_append_printf(text, "Activated: none\n\n"); + else + g_string_append_printf(text, "Activated: %s (%s)\n\n", status->primary->name, status->primary->bootname); g_string_append(text, "=== Slot States ===\n"); slotclasses = r_slot_get_root_classes(status->slots);