Skip to content

Commit

Permalink
avm2: String.toString defaults to ""
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepycatcoding authored and torokati44 committed Aug 18, 2023
1 parent afac907 commit 7316f51
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
8 changes: 7 additions & 1 deletion core/src/avm2/globals/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,13 @@ fn to_string<'gc>(
this: Object<'gc>,
_args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> {
Ok(Value::from(this))
if let Some(this) = this.as_primitive() {
if let Value::String(v) = *this {
return Ok(v.into());
}
}

Ok("".into())
}

/// Implements `String.valueOf`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
num_ticks = 1
known_failure = true
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
num_ticks = 1
known_failure = true
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
num_ticks = 1
known_failure = true

0 comments on commit 7316f51

Please sign in to comment.