From d41d62f57743580f306ac2703561d1f17b45145e Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 23 Mar 2012 10:15:39 -0500 Subject: 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); --- src/mm-serial-port.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c index 33660bf2..3bc12d26 100644 --- a/src/mm-serial-port.c +++ b/src/mm-serial-port.c @@ -1102,7 +1102,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; } -- cgit v1.2.3-70-g09d2