From ee9379697525c7576f9ff6412d87684702953fcd Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Thu, 7 Mar 2019 17:25:06 +0100 Subject: [PATCH] pkg/semtech_loramac: add null guards to radio_events descriptor --- pkg/semtech-loramac/contrib/semtech_loramac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/semtech-loramac/contrib/semtech_loramac.c b/pkg/semtech-loramac/contrib/semtech_loramac.c index 7e14f35242..a5227b323b 100644 --- a/pkg/semtech-loramac/contrib/semtech_loramac.c +++ b/pkg/semtech-loramac/contrib/semtech_loramac.c @@ -630,12 +630,18 @@ static void _semtech_loramac_event_cb(netdev_t *dev, netdev_event_t event) case NETDEV_EVENT_FHSS_CHANGE_CHANNEL: DEBUG("[semtech-loramac] FHSS channel change\n"); - semtech_loramac_radio_events.FhssChangeChannel(((sx127x_t *)dev)->_internal.last_channel); + if(semtech_loramac_radio_events.FhssChangeChannel) { + semtech_loramac_radio_events.FhssChangeChannel(( + (sx127x_t *)dev)->_internal.last_channel); + } break; case NETDEV_EVENT_CAD_DONE: DEBUG("[semtech-loramac] test: CAD done\n"); - semtech_loramac_radio_events.CadDone(((sx127x_t *)dev)->_internal.is_last_cad_success); + if(semtech_loramac_radio_events.CadDone) { + semtech_loramac_radio_events.CadDone(( + (sx127x_t *)dev)->_internal.is_last_cad_success); + } break; default: