From 906b22699d1c0f282257dbda5c977553c8621eca Mon Sep 17 00:00:00 2001
From: Matthias Kolja Miehl <miehl@w3hs.net>
Date: Sun, 21 Aug 2016 03:43:56 +0200
Subject: [PATCH] pkg/nordic_softdevice_ble: gnrc_nordic_ble_6lowpan: fix
 nullPointer error

---
 pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c b/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c
index 156c2289d0..9f2727a8cf 100644
--- a/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c
+++ b/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c
@@ -127,6 +127,11 @@ static void _handle_raw_sixlowpan(ble_mac_inbuf_t *inbuf)
 
 static int _send(gnrc_pktsnip_t *pkt)
 {
+    if (pkt == NULL) {
+        DEBUG("_send_ble: pkt was NULL\n");
+        return -EINVAL;
+    }
+
     gnrc_netif_hdr_t *netif_hdr;
     gnrc_pktsnip_t *payload = pkt->next;
     uint8_t *dst;
@@ -139,10 +144,6 @@ static int _send(gnrc_pktsnip_t *pkt)
     uint8_t *buf = _sendbuf;
     unsigned len = 0;
 
-    if (pkt == NULL) {
-        DEBUG("_send_ble: pkt was NULL\n");
-        return -EINVAL;
-    }
     if (pkt->type != GNRC_NETTYPE_NETIF) {
         DEBUG("_send_ble: first header is not generic netif header\n");
         return -EBADMSG;
-- 
GitLab