novatel: ensure error is set when $NWRAT response parser doesn't match

This commit is contained in:
Aleksander Morgado
2013-04-24 23:08:09 +02:00
parent 2e6ba7cd09
commit 52fd67e365

View File

@@ -86,7 +86,7 @@ nwrat_query_ready (MMBaseModem *self,
GError *error = NULL;
const gchar *response;
GRegex *r;
GMatchInfo *match_info;
GMatchInfo *match_info = NULL;
gint a = -1;
gint b = -1;
@@ -103,13 +103,17 @@ nwrat_query_ready (MMBaseModem *self,
g_assert (r != NULL);
if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &error)) {
g_prefix_error (&error,
"Failed to parse mode/tech response '%s': ",
response);
g_regex_unref (r);
if (error)
g_simple_async_result_take_error (simple, error);
else
g_simple_async_result_set_error (simple,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Couldn't match NWRAT reply: %s",
response);
g_simple_async_result_complete (simple);
g_object_unref (simple);
g_regex_unref (r);
return;
}