Handle reading failure replies correctly everywhere.
This commit is contained in:
@@ -162,7 +162,7 @@ enable (MMModem *modem,
|
||||
static gboolean
|
||||
parse_syscfg (const char *reply, int *mode_a, int *mode_b, guint32 *band, int *unknown1, int *unknown2)
|
||||
{
|
||||
if (strncmp (reply, "^SYSCFG:", 8))
|
||||
if (reply == NULL || strncmp (reply, "^SYSCFG:", 8))
|
||||
return FALSE;
|
||||
|
||||
if (sscanf (reply + 8, "%d,%d,%x,%d,%d", mode_a, mode_b, band, unknown1, unknown2))
|
||||
|
@@ -194,7 +194,11 @@ get_string_done (MMSerial *serial, const char *reply, gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
|
||||
mm_callback_info_set_result (info, g_strdup (reply), g_free);
|
||||
if (reply)
|
||||
mm_callback_info_set_result (info, g_strdup (reply), g_free);
|
||||
else
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s", "Reading information failed.");
|
||||
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
@@ -809,7 +813,7 @@ scan_done (MMSerial *serial, const char *reply, gpointer user_data)
|
||||
|
||||
results = g_ptr_array_new ();
|
||||
|
||||
if (!strncmp (reply, "+COPS: ", 7)) {
|
||||
if (reply && !strncmp (reply, "+COPS: ", 7)) {
|
||||
/* Got valid reply */
|
||||
GRegex *r;
|
||||
GMatchInfo *match_info;
|
||||
@@ -927,7 +931,7 @@ get_signal_quality_done (MMSerial *serial, const char *reply, gpointer user_data
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
guint32 result = 0;
|
||||
|
||||
if (!strncmp (reply, "+CSQ: ", 6)) {
|
||||
if (reply && !strncmp (reply, "+CSQ: ", 6)) {
|
||||
/* Got valid reply */
|
||||
int quality;
|
||||
int ber;
|
||||
|
Reference in New Issue
Block a user