diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 4dcc1785..5590fa9c 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -114,7 +114,8 @@ bool MeshService::reloadConfig() void MeshService::reloadOwner() { assert(nodeInfoPlugin); - nodeInfoPlugin->sendOurNodeInfo(); + if(nodeInfoPlugin) + nodeInfoPlugin->sendOurNodeInfo(); nodeDB.saveToDisk(); } @@ -170,12 +171,18 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies) NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); assert(node); - DEBUG_MSG("Sending network ping to 0x%x, with position=%d, wantReplies=%d\n", dest, node->has_position, wantReplies); - assert(positionPlugin && nodeInfoPlugin); - if (node->has_position) - positionPlugin->sendOurPosition(dest, wantReplies); - else - nodeInfoPlugin->sendOurNodeInfo(dest, wantReplies); + if (node->has_position) { + if(positionPlugin) { + DEBUG_MSG("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies); + positionPlugin->sendOurPosition(dest, wantReplies); + } + } + else { + if(nodeInfoPlugin) { + DEBUG_MSG("Sending nodeinfo ping to 0x%x, wantReplies=%d\n", dest, wantReplies); + nodeInfoPlugin->sendOurNodeInfo(dest, wantReplies); + } + } } NodeInfo *MeshService::refreshMyNodeInfo() diff --git a/src/plugins/NodeInfoPlugin.cpp b/src/plugins/NodeInfoPlugin.cpp index 82c16cbd..f5f3ae19 100644 --- a/src/plugins/NodeInfoPlugin.cpp +++ b/src/plugins/NodeInfoPlugin.cpp @@ -65,8 +65,7 @@ int32_t NodeInfoPlugin::runOnce() currentGeneration = radioGeneration; DEBUG_MSG("Sending our nodeinfo to mesh (wantReplies=%d)\n", requestReplies); - assert(nodeInfoPlugin); - nodeInfoPlugin->sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies) + sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies) return getPref_position_broadcast_secs() * 1000; }