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.
This commit is contained in:
@@ -38,7 +38,14 @@ calls_call_state_to_string (GString *string,
|
|||||||
GEnumValue *value;
|
GEnumValue *value;
|
||||||
|
|
||||||
klass = g_type_class_ref (CALLS_TYPE_CALL_STATE);
|
klass = g_type_class_ref (CALLS_TYPE_CALL_STATE);
|
||||||
|
|
||||||
value = g_enum_get_value (klass, (gint)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);
|
g_string_assign (string, value->value_nick);
|
||||||
string->str[0] = g_ascii_toupper (string->str[0]);
|
string->str[0] = g_ascii_toupper (string->str[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user