mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-09 09:28:10 +02:00
libupower-glib: up-client: Fix crash when printing the error message from a NULL GError pointer
Passing a NULL UpClient to up_client_get_devices2() led to the following error message since up_client_get_devices_full() returned immediately without properly setting up a GError with the reasons for the error. (upower:21076): libupower-glib-CRITICAL **: 16:33:53.919: up_client_get_devices_full: assertion 'UP_IS_CLIENT (client)' failed Segmentation fault (core dumped) ./upower -d Related: https://gitlab.freedesktop.org/upower/upower/-/merge_requests/296
This commit is contained in:
parent
f61735aa6d
commit
991a7d9433
1 changed files with 9 additions and 1 deletions
|
|
@ -106,7 +106,15 @@ up_client_get_devices_full (UpClient *client,
|
|||
GPtrArray *array;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (UP_IS_CLIENT (client), NULL);
|
||||
if (!UP_IS_CLIENT (client)) {
|
||||
g_set_error (error, G_IO_ERROR,
|
||||
G_IO_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid UpClient object");
|
||||
g_return_if_fail_warning (G_LOG_DOMAIN,
|
||||
G_STRFUNC,
|
||||
"UP_IS_CLIENT (client)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (up_exported_daemon_call_enumerate_devices_sync (client->priv->proxy,
|
||||
&devices,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue