avm2: Fix `Error.toString` regression

This was introduced by #14897, and to make sure this won't happen again I added a test.

Fixes #14901.
This commit is contained in:
sleepycatcoding 2024-01-22 20:02:43 +02:00 committed by TÖRÖK Attila
parent 2057417824
commit 1804c23b93
5 changed files with 11 additions and 1 deletions

View File

@ -23,7 +23,7 @@ package {
prototype.toString = function():String {
var self:Error = this;
return self.message.length == 0 ? self.name : self.name + ": " + self.message;
return self.message !== "" ? self.name + ": " + self.message : self.name;
};
}
}

View File

@ -0,0 +1,8 @@
package {
import flash.display.Sprite;
public class Test extends Sprite {}
}
var e = new Error(null);
trace(e.toString());

View File

@ -0,0 +1 @@
Error: null

Binary file not shown.

View File

@ -0,0 +1 @@
num_frames = 1