Text can now accept undefined or null as the text argument in the constructor and will cast it as an empty string.

This commit is contained in:
photonstorm 2015-08-06 10:28:49 +01:00
parent 80540ea919
commit 9a0b6c24a4
2 changed files with 11 additions and 1 deletions

View file

@ -262,6 +262,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
* TypeScript definitions fixes and updates (thanks @clark-stevenson @vrecluse)
* JSDoc typo fixes (thanks )
* VideoStream.active = false is used if the browser supports it, otherwise it falls back to VideoStream.stop.
* Text can now accept `undefined` or `null` as the `text` argument in the constructor and will cast it as an empty string.
### Bug Fixes

View file

@ -40,7 +40,16 @@ Phaser.Text = function (game, x, y, text, style) {
x = x || 0;
y = y || 0;
text = text.toString() || '';
if (text === undefined || text === null)
{
text = '';
}
else
{
text = text.toString();
}
style = style || {};
/**