When a line comes in from the modem, we check against prefixes
in outstanding commands and unsolicited notifications. If the
outstanding command has not yet been sent (cmd_bytes_written == 0),
we still check it resulting in access violation.
cmd = g_queue_peek_head(p->command_queue);
- if (cmd) {
+ if (cmd && p->cmd_bytes_written > 0) {
char c = cmd->cmd[p->cmd_bytes_written - 1];
/* We check that we have submitted a terminator, in which case