diff --git a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c index 52a2f06155a80837b58e9bd9ae5332cff300a9a3..d049c4c07e8530f1300b63356605de35d716bfb2 100644 --- a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c +++ b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c @@ -392,12 +392,17 @@ static int _fill_ipv6_hdr(gnrc_netif_t *netif, gnrc_pktsnip_t *ipv6) /* check if e.g. extension header was not already marked */ if (hdr->nh == PROTNUM_RESERVED) { - hdr->nh = gnrc_nettype_to_protnum(ipv6->next->type); - - /* if still reserved: mark no next header */ - if (hdr->nh == PROTNUM_RESERVED) { + if (ipv6->next == NULL) { hdr->nh = PROTNUM_IPV6_NONXT; } + else { + hdr->nh = gnrc_nettype_to_protnum(ipv6->next->type); + + /* if still reserved: mark no next header */ + if (hdr->nh == PROTNUM_RESERVED) { + hdr->nh = PROTNUM_IPV6_NONXT; + } + } } DEBUG("ipv6: set next header to %u\n", hdr->nh);