Explorar el Código

Added safeguard against malformed datatype specifier produced by UAModeler.

ichrispa hace 10 años
padre
commit
cffc91ab57
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  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: