From 9b49655e9c7718cb8a37f4c95789569f80616667 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 15 May 2024 15:37:19 +0100 Subject: [PATCH] The method `TextureManager.checkKey` will now return `false` if the key is not a string, which fixes issues where a texture could be created if a key was given that was already in use --- src/textures/TextureManager.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/textures/TextureManager.js b/src/textures/TextureManager.js index 3cb043c8ba..1359756ed7 100644 --- a/src/textures/TextureManager.js +++ b/src/textures/TextureManager.js @@ -235,7 +235,7 @@ var TextureManager = new Class({ */ checkKey: function (key) { - if (this.exists(key)) + if (!key || typeof key !== 'string' || this.exists(key)) { if (!this.silentWarnings) { @@ -473,7 +473,7 @@ var TextureManager = new Class({ * This allows you to then use the Texture as a normal texture for texture based Game Objects like Sprites. * * This is a WebGL only feature. - * + * * Prior to Phaser 3.80.0, this method took a bare `WebGLTexture` * as the `glTexture` parameter. You must now wrap the `WebGLTexture` in a * `WebGLTextureWrapper` instance before passing it to this method. @@ -1166,12 +1166,12 @@ var TextureManager = new Class({ /** * Creates a texture from an array of colour data. - * + * * This is only available in WebGL mode. - * + * * If the dimensions provided are powers of two, the resulting texture * will be automatically set to wrap by the WebGL Renderer. - * + * * @method Phaser.Textures.TextureManager#addUint8Array * @fires Phaser.Textures.Events#ADD * @since 3.80.0