shared/btp: Allow to call btp_send without valid btp 19/204919/1
authorSzymon Janc <szymon.janc@codecoup.pl>
Fri, 23 Feb 2018 13:40:10 +0000 (14:40 +0100)
committerAmit Purwar <amit.purwar@samsung.com>
Mon, 15 Apr 2019 03:32:12 +0000 (09:02 +0530)
This allows to unconditionally call btp_send from code that generates
events eg when mapping those from D-Bus events.

Change-Id: Id47fb80d7116d0fd8ac4f48567ee115ca43c3e89
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
src/shared/btp.c

index d981621..c0c21a7 100644 (file)
@@ -293,6 +293,9 @@ bool btp_send(struct btp *btp, uint8_t service, uint8_t opcode, uint8_t index,
        struct pending_message *msg;
        size_t len;
 
+       if (!btp)
+               return false;
+
        len = sizeof(*hdr) + length;
        hdr = l_malloc(len);
        if (!hdr)