diff --git a/DecisionSystem/CentralisedDecision/commander.py b/DecisionSystem/CentralisedDecision/commander.py index c78d15a..840a822 100644 --- a/DecisionSystem/CentralisedDecision/commander.py +++ b/DecisionSystem/CentralisedDecision/commander.py @@ -60,7 +60,12 @@ class Commander: self.make_decision() def on_message(self, client, userdata, message): - messageDict = umsgpack.unpackb() + try: + messageDict = umsgpack.unpackb(message.payload) + except: + print("Incorrect Message") + return + if "type" in messageDict.keys: # Need to consider that a malicious message may have a type with incorrect subtypes. if messageDict["type"] == "connect":