You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError(`${obj.name} must be of type ${tClass.name}`);
}
Then because the condition is true, the code fails in line 145 with the error
TypeError: Cannot read property 'name' of null
Currently, all Enum classes use default _keyForValue for checks in their keyForValue methods so it is impossible to set null for all Enum properties (mandatory or optional) in all Structs and Messages
Steps to reproduce:
Create for example the new instance of KeyboardProperties structure
Try to set KeyboardLayout parameter (according to the spec this parameter is not mandatory) by calling setKeyboardLayout method with null value
ER: null is successfully set, AR: the TypeError
newSDL.rpc.structs.KeyboardProperties().setKeyboardLayout(null)// this fails with TypeError: Cannot read property 'name' of null
The text was updated successfully, but these errors were encountered:
Possible solution is to skip null value for Enum the same way as for RpcStruct
}elseif(obj!==null&&((tClass.prototypeinstanceofEnum&&tClass.keyForValue(obj)===null)||(tClass.prototypeinstanceofRpcStruct&&obj.constructor!==tClass))){thrownewError(`${obj.name} must be of type ${tClass.name}`);}
Based on the condition below the
keyForValue
call based on the default Enum's_keyForValue
will always returnnull
here fornull
objsdl_javascript_suite/lib/js/src/rpc/RpcStruct.js
Lines 141 to 146 in 1e0e6be
Then because the condition is
true
, the code fails in line 145 with the errorCurrently, all Enum classes use default
_keyForValue
for checks in theirkeyForValue
methods so it is impossible to setnull
for all Enum properties (mandatory or optional) in all Structs and MessagesSteps to reproduce:
KeyboardProperties
structureKeyboardLayout
parameter (according to the spec this parameter is not mandatory) by callingsetKeyboardLayout
method withnull
valuenull
is successfully set, AR: the TypeErrorThe text was updated successfully, but these errors were encountered: