From 5937874c4433064ca1e2748f5cdf40ab14cc77e7 Mon Sep 17 00:00:00 2001 From: Bob Ham Date: Mon, 1 Jul 2019 15:02:08 +0100 Subject: [PATCH] calls-call: Fix crash with null call state Account for having a null (zero) call state in calls_call_state_to_string. This fixes a crash as a result of the recent UI changes. --- src/calls-call.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/calls-call.c b/src/calls-call.c index e1d3d6e..3db3299 100644 --- a/src/calls-call.c +++ b/src/calls-call.c @@ -38,7 +38,14 @@ calls_call_state_to_string (GString *string, GEnumValue *value; klass = g_type_class_ref (CALLS_TYPE_CALL_STATE); + value = g_enum_get_value (klass, (gint)state); + if (!value) + { + return g_string_printf (string, + "Unknown call state (%d)", + (gint)state); + } g_string_assign (string, value->value_nick); string->str[0] = g_ascii_toupper (string->str[0]);