avm2: Fix getQualifiedClassName for null and undefined
This commit is contained in:
parent
66fa67cdcc
commit
53f42e0bec
|
@ -193,10 +193,14 @@ pub fn get_qualified_class_name<'gc>(
|
|||
_this: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let obj = args
|
||||
.get(0)
|
||||
.unwrap_or(&Value::Undefined)
|
||||
.coerce_to_object(activation)?;
|
||||
// This is a native method, which enforces the argument count.
|
||||
let val = args[0];
|
||||
match val {
|
||||
Value::Null => return Ok("null".into()),
|
||||
Value::Undefined => return Ok("void".into()),
|
||||
_ => {}
|
||||
}
|
||||
let obj = val.coerce_to_object(activation)?;
|
||||
|
||||
let class = match obj.as_class_object() {
|
||||
Some(class) => class,
|
||||
|
|
|
@ -20,4 +20,7 @@ trace(getQualifiedClassName(String));
|
|||
|
||||
trace(getQualifiedClassName(new flash.utils.ByteArray()));
|
||||
|
||||
trace(getQualifiedClassName(new String()));
|
||||
trace(getQualifiedClassName(new String()));
|
||||
|
||||
trace(getQualifiedClassName(null));
|
||||
trace(getQualifiedClassName(undefined));
|
|
@ -5,4 +5,6 @@ com.very.long.namespace::example
|
|||
int
|
||||
String
|
||||
flash.utils::ByteArray
|
||||
String
|
||||
String
|
||||
null
|
||||
void
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue