From fe20a273bb3979d9e806d828486633249d073ede Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Thu, 2 Jan 2014 12:10:14 -0500 Subject: Avoid hitting a NULL pointer when using callbacks. --- src/isotp/receive.c | 4 +++- src/isotp/send.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/isotp/receive.c b/src/isotp/receive.c index fa96156d..1692f8d3 100644 --- a/src/isotp/receive.c +++ b/src/isotp/receive.c @@ -6,7 +6,9 @@ bool isotp_handle_single_frame(IsoTpHandle* handle, IsoTpMessage* message) { } void isotp_complete_receive(IsoTpHandle* handle, IsoTpMessage* message) { - handle->receive_handle.message_received_callback(message); + if(handle->receive_handle.message_received_callback != NULL) { + handle->receive_handle.message_received_callback(message); + } } IsoTpHandle isotp_receive(IsoTpShims* shims, diff --git a/src/isotp/send.c b/src/isotp/send.c index 6cce5c92..85e35744 100644 --- a/src/isotp/send.c +++ b/src/isotp/send.c @@ -6,7 +6,9 @@ void isotp_complete_send(IsoTpShims* shims, IsoTpMessage* message, bool status, IsoTpMessageSentHandler callback) { - callback(message, status); + if(callback != NULL) { + callback(message, status); + } } IsoTpHandle isotp_send_single_frame(IsoTpShims* shims, IsoTpMessage* message, -- cgit 1.2.3-korg