[PATCH 1/2] Linux: Fix warning in up_device_supply_get_design_voltage

Timothée Ravier siosm99 at gmail.com
Sat Aug 24 15:41:41 PDT 2013


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



More information about the devkit-devel mailing list