diff options
author | Bastien Nocera <hadess@hadess.net> | 2023-04-18 12:31:19 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2023-04-18 12:31:19 +0200 |
commit | 5aabeb706770c342acb1448798b182e0dad28f6c (patch) | |
tree | 88680998628351f5211867f7f6157cbde8ee1f72 | |
parent | b83b0ff56864f8ceb2a15b8c144d74be39af6f4a (diff) | |
download | upower-5aabeb706770c342acb1448798b182e0dad28f6c.tar.gz |
linux: Guard against devices with no serial
Avoid warning if one of the devices doesn't have a serial:
GLib-CRITICAL **: g_ascii_strcasecmp: assertion 's2 != NULL' failed
#1 0x00007fbe1b7c0b6d in g_log (log_domain=log_domain@entry=0x7fbe1b81300e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7fbe1b81e9dd "%s: assertion '%s' failed") at ../../../../Projects/jhbuild/glib/glib/gmessages.c:1460
#2 0x00007fbe1b7c1af9 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7fbe1b81300e "GLib", pretty_function=pretty_function@entry=0x7fbe1b8238c0 <__func__.24> "g_ascii_strcasecmp", expression=expression@entry=0x7fbe1b815e0e "s2 != NULL") at ../../../../Projects/jhbuild/glib/glib/gmessages.c:2930
#3 0x00007fbe1b7dad3a in g_ascii_strcasecmp (s1=<optimized out>, s2=<optimized out>) at ../../../../Projects/jhbuild/glib/glib/gstrfuncs.c:1878
#4 0x0000000000411025 in find_duplicate_device (backend=backend@entry=0xc3dc00, device=device@entry=0xc782e0) at ../../../../Projects/jhbuild/upower/src/linux/up-backend.c:139
-rw-r--r-- | src/linux/up-backend.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c index d946b99..76197df 100644 --- a/src/linux/up-backend.c +++ b/src/linux/up-backend.c @@ -126,6 +126,8 @@ find_duplicate_device (UpBackend *backend, guint i; g_object_get (G_OBJECT (device), "serial", &serial, NULL); + if (!serial) + return NULL; array = up_device_list_get_array (backend->priv->device_list); for (i = 0; i < array->len; i++) { |