Skip to content

Commit d2bcb35

Browse files
committed
If transformUrl is given an invalid URL it returns false.
1 parent 734fbfe commit d2bcb35

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/loader/Loader.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,10 +1870,15 @@ Phaser.Loader.prototype = {
18701870
* @method Phaser.Loader#transformUrl
18711871
* @protected
18721872
* @param {string} url - The url to transform
1873-
* @return {string} The transformed url
1873+
* @return {string} The transformed url. In rare cases where the url isn't specified it will return false instead.
18741874
*/
18751875
transformUrl: function (url) {
18761876

1877+
if (!url)
1878+
{
1879+
return false;
1880+
}
1881+
18771882
if (url.substr(0, 4) === 'http' || url.substr(0, 2) === '//')
18781883
{
18791884
return url;
@@ -2067,7 +2072,6 @@ Phaser.Loader.prototype = {
20672072
};
20682073

20692074
file.data.onerror = function () {
2070-
// file.data.removeEventListener('canplay', playThroughEvent, false);
20712075
file.data.removeEventListener('canplaythrough', playThroughEvent, false);
20722076
file.data.removeEventListener('loadeddata', playThroughEvent, false);
20732077
file.data.onerror = null;

0 commit comments

Comments
 (0)