summaryrefslogtreecommitdiff
path: root/src/mm-modem-helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mm-modem-helpers.c')
-rw-r--r--src/mm-modem-helpers.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 8cf9a29f..928fa6f3 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -1511,13 +1511,14 @@ mm_3gpp_parse_operator (const gchar *reply,
* string of the bytes of the operator name as encoded by the current
* character set.
*/
- if (cur_charset == MM_MODEM_CHARSET_UCS2)
+ if (cur_charset == MM_MODEM_CHARSET_UCS2) {
+ /* In this case we're already checking UTF-8 validity */
operator = mm_charset_take_and_convert_to_utf8 (operator, MM_MODEM_CHARSET_UCS2);
-
+ }
/* Ensure the operator name is valid UTF-8 so that we can send it
* through D-Bus and such.
*/
- if (!g_utf8_validate (operator, -1, NULL)) {
+ else if (!g_utf8_validate (operator, -1, NULL)) {
g_free (operator);
return NULL;
}
@@ -1525,7 +1526,7 @@ mm_3gpp_parse_operator (const gchar *reply,
/* Some modems (Novatel LTE) return the operator name as "Unknown" when
* it fails to obtain the operator name. Return NULL in such case.
*/
- if (g_ascii_strcasecmp (operator, "unknown") == 0) {
+ if (operator && g_ascii_strcasecmp (operator, "unknown") == 0) {
g_free (operator);
return NULL;
}