Lutz Roeder 3 лет назад
Родитель
Сommit
ba3a95409d
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      source/om.js

+ 3 - 3
source/om.js

@@ -578,10 +578,10 @@ om.Utility = class {
             'complex64', 'complex128', 'qint8', 'qint16', 'qint32', 'quint8', 'quint16', 'resource',
             'stringref', 'dual', 'variant', 'bfloat16', 'int4', 'uint1', 'int2', 'uint2'
         ];
-        if (value < om.Utility._types.length) {
-            return om.Utility._types[value];
+        if (value >= om.Utility._types.length) {
+            throw new om.Error("Unsupported dtype '" + value + "'.");
         }
-        throw new om.Error("Unsupported dtype '" + value + "'.");
+        return om.Utility._types[value];
     }
 
     static decodeText(value) {