diff options
author | Dan Williams <dcbw@redhat.com> | 2012-03-23 10:15:39 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-03-23 10:17:09 -0500 |
commit | 53a53766bfc47dab68f372458a7bb54c72f1f5f0 (patch) | |
tree | 8c022e6ab36e4d43d1bb773a09cfbb588d063035 | |
parent | 3a39a14b4bab7246a6ca95ed77bceb714712d135 (diff) |
serial: fix crash when sending some commands to a closed port (lp:963102)
If the command we're sending doesn't have a callback, don't try
to call NULL. Triggered if the port got closed (because the modem
crashed, or refcounting errors or whatever) with some code like this:
mm_at_serial_port_queue_command (MM_AT_SERIAL_PORT (port), "+CREG=0", 3, NULL, NULL);
-rw-r--r-- | src/mm-serial-port.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c index ab64dc80..84044bd0 100644 --- a/src/mm-serial-port.c +++ b/src/mm-serial-port.c @@ -1027,7 +1027,8 @@ internal_queue_command (MMSerialPort *self, GError *error = g_error_new_literal (MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_FAILED, "Sending command failed: device is not enabled"); - callback (self, NULL, error, user_data); + if (callback) + callback (self, NULL, error, user_data); g_error_free (error); return; } |