From 94824fbb98599360fcca511fc5b55517d0a579fb Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Fri, 23 Feb 2018 18:21:01 +0000 Subject: [PATCH] Avoid coredump on "untracked" aircraft (icao 000000) Clean up the first-message-squelch logic a little. --- mode_s.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mode_s.c b/mode_s.c index 9f943b4..cd6afc4 100644 --- a/mode_s.c +++ b/mode_s.c @@ -2106,14 +2106,13 @@ void useModesMessage(struct modesMessage *mm) { // forward messages when we have seen two of them. if (Modes.net) { - if (Modes.net_verbatim || mm->msgtype == 32) { + if (Modes.net_verbatim || mm->msgtype == 32 || !a) { // Unconditionally send modesQueueOutput(mm, a); } else if (a->messages > 1) { - // If this is the second message, and we - // squelched the first message, then re-emit the - // first message now. - if (!Modes.net_verbatim && a && a->messages == 2) { + // Suppress the first message. When we receive a second message, + // emit the first two messages. + if (a->messages == 2) { modesQueueOutput(&a->first_message, a); } modesQueueOutput(mm, a);