This avoids filling the logs with the unnecessary warning line:
GLib-CRITICAL **: g_ascii_strcasecmp: assertion `s1 != NULL' failed
as seen in https://bugzilla.redhat.com/show_bug.cgi?id=847874 and
https://bugzilla.redhat.com/show_bug.cgi?id=863524
---
 src/linux/up-device-supply.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index 68f3537..a29649f 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -407,7 +407,7 @@ up_device_supply_get_design_voltage (const gchar 
*native_path)
 
        /* is this a USB device? */
        device_type = up_device_supply_get_string (native_path, "type");
-       if (g_ascii_strcasecmp (device_type, "USB") == 0) {
+       if (device_type != NULL && g_ascii_strcasecmp (device_type, "USB") == 
0) {
                g_debug ("USB device, so assuming 5v");
                voltage = 5.0f;
                goto out;
-- 
1.8.3.4

_______________________________________________
devkit-devel mailing list
devkit-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/devkit-devel

Reply via email to