Description: Check if message body is NULL before getting number of children
 Fixes segmentation fault from calling g_variant_n_children on NULL GVariant*.
 The body returned by g_dbus_message_get_body can be NULL
 (https://docs.gtk.org/gio/method.DBusMessage.get_body.html) which is not
 accounted for in current error handling code.
Origin: upstream, https://github.com/altdesktop/playerctl/pull/349
Forwarded: not-needed
Reviewed-by: Nick Morrott <nickm@debian.org>
Last-Update: 2026-08-06
---
--- a/playerctl/playerctl-daemon.c
+++ b/playerctl/playerctl-daemon.c
@@ -738,7 +738,7 @@
         g_dbus_method_invocation_return_value(invocation, body);
         break;
     case G_DBUS_MESSAGE_TYPE_ERROR: {
-        if (g_variant_n_children(body) > 1) {
+        if (body != NULL && g_variant_n_children(body) > 1) {
             GVariant *error_message_variant = g_variant_get_child_value(body, 1);
             const char *error_message = g_variant_get_string(error_message_variant, 0);
             g_dbus_method_invocation_return_dbus_error(
