From e94227cddd923852598003c27b0719e38236c479 Mon Sep 17 00:00:00 2001 From: geeksville Date: Thu, 23 Apr 2020 12:48:00 -0700 Subject: [PATCH] cope with missing interfaces in send --- src/rf95/Router.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rf95/Router.cpp b/src/rf95/Router.cpp index 6b949c1f..dff4b779 100644 --- a/src/rf95/Router.cpp +++ b/src/rf95/Router.cpp @@ -51,9 +51,13 @@ void Router::loop() */ ErrorCode Router::send(MeshPacket *p) { - assert(iface); - DEBUG_MSG("Sending packet via interface fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id); - return iface->send(p); + if (iface) { + DEBUG_MSG("Sending packet via interface fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id); + return iface->send(p); + } else { + DEBUG_MSG("Dropping packet - no interfaces - fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id); + return ERRNO_NO_INTERFACES; + } } #include "GPS.h"