From ddb021415ba16552d0ac14472e251f00e37f5e1d Mon Sep 17 00:00:00 2001 From: Keith Preston Date: Mon, 17 Aug 2009 10:39:40 -0500 Subject: [PATCH] Bug 16161 - Don't crash when network info is empty --- providers/gsmloc/geoclue-gsmloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/providers/gsmloc/geoclue-gsmloc.c b/providers/gsmloc/geoclue-gsmloc.c index 32014f4..3a50fdf 100644 --- a/providers/gsmloc/geoclue-gsmloc.c +++ b/providers/gsmloc/geoclue-gsmloc.c @@ -179,6 +179,10 @@ static gboolean geoclue_gsmloc_get_cell (GeoclueGsmloc *gsmloc, } strings = g_strsplit (netinfo.NetworkCode, " ", 2); + if (!strings[0] || !strings[1]) { + g_strfreev (strings); + return FALSE; + } *mcc = strings[0]; *mnc = strings[1]; g_free (strings); @@ -186,7 +190,6 @@ static gboolean geoclue_gsmloc_get_cell (GeoclueGsmloc *gsmloc, *lac = g_strdup_printf ("%d", i_lac); *cid = g_strdup_printf ("%d", i_cid); - /* TODO should make sure all return values have data? */ return TRUE; } -- GitLab