aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-03-10 14:57:23 -0800
committerDan Williams <dcbw@redhat.com>2010-03-10 14:57:23 -0800
commit6a32d374cd7d0fb23785c974bf8d8b1ba64e97b5 (patch)
tree6362d8ec939c839bc2cdafb1073f8e963aa56ea2
parent1979512d8dfb6428353e6bf358f908973a318095 (diff)
serial: not all commands have response callbacks
So don't crash if they don't.
-rw-r--r--src/mm-serial-port.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index 8de0cdd1..210ce2e6 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -508,12 +507,14 @@ mm_serial_port_got_response (MMSerialPort *self, GError *error)
if (info->cached && !error)
mm_serial_port_set_cached_reply (self, info->command, priv->response);
- g_warn_if_fail (MM_SERIAL_PORT_GET_CLASS (self)->handle_response != NULL);
- MM_SERIAL_PORT_GET_CLASS (self)->handle_response (self,
- priv->response,
- error,
- info->callback,
- info->user_data);
+ if (info->callback) {
+ g_warn_if_fail (MM_SERIAL_PORT_GET_CLASS (self)->handle_response != NULL);
+ MM_SERIAL_PORT_GET_CLASS (self)->handle_response (self,
+ priv->response,
+ error,
+ info->callback,
+ info->user_data);
+ }
g_byte_array_free (info->command, TRUE);
g_slice_free (MMQueueData, info);