From 96be67870bf9543bb6ece4b1ac8bcbba5af5bbe4 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Wed, 22 Nov 2023 11:22:48 +1100 Subject: [PATCH] FlightData: handle bad squawk code from ping --- GCSViews/FlightData.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GCSViews/FlightData.cs b/GCSViews/FlightData.cs index 044a3e63f6..46ae7561bb 100644 --- a/GCSViews/FlightData.cs +++ b/GCSViews/FlightData.cs @@ -6180,7 +6180,14 @@ private void updateTransponder() if (!Squawk_nud.Focused) { Squawk_nud.ValueChanged -= new EventHandler(Squawk_nud_ValueChanged); - Squawk_nud.Value = (decimal)MainV2.comPort.MAV.cs.xpdr_mode_A_squawk_code; + try + { + Squawk_nud.Value = (decimal)MainV2.comPort.MAV.cs.xpdr_mode_A_squawk_code; + // if the value is bad, we need to be able to reset it, so silent fail + } + catch + { + } Squawk_nud.ValueChanged += new EventHandler(Squawk_nud_ValueChanged); }