Fix MatchMD5 result if no serial connection available
authorlaurent
Fri, 04 Jun 2010 17:04:25 +0200
changeset 562 2c8f08f4f874
parent 561 4cc6eef4778f
child 564 464d470bdbd7
Fix MatchMD5 result if no serial connection available
connectors/LPC/LPCAppObject.py
--- a/connectors/LPC/LPCAppObject.py	Fri Jun 04 15:39:14 2010 +0200
+++ b/connectors/LPC/LPCAppObject.py	Fri Jun 04 17:04:25 2010 +0200
@@ -42,7 +42,7 @@
                 self.pluginsroot.logger.write_error(str(e)+"\n")
                 self.SerialConnection = None
                 self.PLCStatus = "Disconnected"
-                return None
+        return None
 
     def StartPLC(self, debug=False):
         self.HandleSerialTransaction(STARTTransaction())
@@ -61,7 +61,9 @@
 
     def MatchMD5(self, MD5):
         data = self.HandleSerialTransaction(GET_PLCIDTransaction())
-        return data[:32] == MD5
+        if data is not None:
+            return data[:32] == MD5
+        return False
 
     class IEC_STRING(ctypes.Structure):
         """