Procházet zdrojové kódy

Added safeguard against malformed datatype specifier produced by UAModeler.

ichrispa před 9 roky
rodič
revize
cffc91ab57
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 5 0
      tools/pyUANamespace/ua_builtin_types.py

+ 5 - 0
tools/pyUANamespace/ua_builtin_types.py

@@ -328,6 +328,11 @@ class opcua_value_t():
     # -1: Scalar
     #  0: x-dim | x>0
     #  n: n-dim | n>0
+    if (len(self.value) == 0):
+      return code
+    if not isinstance(self.value[0], opcua_value_t):
+      return code
+  
     if self.parent.valueRank() != -1 and (self.parent.valueRank() >=0 or (len(self.value) > 1 and (self.parent.valueRank() != -2 or self.parent.valueRank() != -3))):
       # User the following strategy for all directly mappable values a la 'UA_Type MyInt = (UA_Type) 23;'
       if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_GUID: