huawei: ensure error is set when ^CPIN response parser doesn't match

This commit is contained in:
Aleksander Morgado
2013-04-25 09:36:51 +02:00
parent 40dc35a657
commit 2e6ba7cd09
+10 -3
View File
@@ -283,6 +283,7 @@ load_unlock_retries_finish (MMIfaceModem *self,
const gchar *result;
GRegex *r;
GMatchInfo *match_info = NULL;
GError *match_error = NULL;
guint i;
MMModemLock locks[4] = {
MM_MODEM_LOCK_SIM_PUK,
@@ -299,9 +300,15 @@ load_unlock_retries_finish (MMIfaceModem *self,
G_REGEX_UNGREEDY, 0, NULL);
g_assert (r != NULL);
if (!g_regex_match_full (r, result, strlen (result), 0, 0, &match_info, error)) {
g_prefix_error (error,
"Could not parse ^CPIN results: ");
if (!g_regex_match_full (r, result, strlen (result), 0, 0, &match_info, &match_error)) {
if (match_error)
g_propagate_error (error, match_error);
else
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Could not parse ^CPIN results: Response didn't match (%s)",
result);
g_regex_unref (r);
return NULL;
}