aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2020-01-28 12:25:56 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2020-01-28 12:25:56 +0200
commita6428887f09c930a19266aa93c1bfbf77a534fac (patch)
tree153024238a110f6f549e6dad1ebc41f063be20e3 /Software/Visual_Studio
parent9db4506d34e2ff704ef00d6047338d049be51b46 (diff)
downloadTango-a6428887f09c930a19266aa93c1bfbf77a534fac.tar.gz
Tango-a6428887f09c930a19266aa93c1bfbf77a534fac.zip
Implemented fallback for an invalid incoming message.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Tango.Transport/TransporterBase.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
index 8bc26866e..aec7654b1 100644
--- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
+++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
@@ -1173,7 +1173,18 @@ namespace Tango.Transport
LogManager.Log($"{GetExtendedComponentName()}: Message received...", LogCategory.Debug);
LogManager.Log($"{GetExtendedComponentName()}: Parsing message container...", LogCategory.Debug);
- MessageContainer container = Encoder.DecodeContainer(data);
+
+ MessageContainer container = null;
+
+ try
+ {
+ container = Encoder.DecodeContainer(data);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"{GetExtendedComponentName()}: Error parsing message container. Skipping incoming message...");
+ continue;
+ }
LogManager.Log($"{GetExtendedComponentName()}: Message was identified as " + container.Type + ".", LogCategory.Debug);