From ee6d6f0331f4301b0f7b91e3707066b8a6aab0c1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 7 Jul 2020 14:08:00 +0200 Subject: [PATCH] fix machine serial try/catch error --- Thermo.Active.Utils/supportFunctions.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Thermo.Active.Utils/supportFunctions.cs b/Thermo.Active.Utils/supportFunctions.cs index 80fd2587..5defccca 100644 --- a/Thermo.Active.Utils/supportFunctions.cs +++ b/Thermo.Active.Utils/supportFunctions.cs @@ -560,12 +560,19 @@ namespace Thermo.Active.Utils { machineNumber = "0000"; } - if (containsLetters) - // Convert ASCII string to a single INT - intMachineVal = SupportFunctions.ConvertAsciiStringToInt(machineNumber); - else - // Convert string of digits to a INT - intMachineVal = int.Parse(machineNumber); + try + { + if (containsLetters) + // Convert ASCII string to a single INT + intMachineVal = SupportFunctions.ConvertAsciiStringToInt(machineNumber); + else + // Convert string of digits to a INT + intMachineVal = int.Parse(machineNumber); + } + catch + { + intMachineVal = 0; + } } //----- Chipher Private Class ---------------------------------