mirror of https://github.com/axmolengine/axmol.git
#14128 Fix cc.loader.getRes crash caused by null type
This commit is contained in:
parent
9eeda122e9
commit
d3664b9616
|
@ -686,8 +686,9 @@ cc.loader = {
|
||||||
if (cached)
|
if (cached)
|
||||||
return cached;
|
return cached;
|
||||||
var type = cc.path.extname(url);
|
var type = cc.path.extname(url);
|
||||||
|
if (!type) return cc.log("cc.loader.getRes: Invalid url");
|
||||||
var loader = this._register[type.toLowerCase()];
|
var loader = this._register[type.toLowerCase()];
|
||||||
if(!loader) return cc.log("loader for [" + type + "] not exists!");
|
if (!loader) return cc.log("cc.loader.getRes: loader for [" + type + "] not exists!");
|
||||||
var basePath = loader.getBasePath ? loader.getBasePath() : this.resPath;
|
var basePath = loader.getBasePath ? loader.getBasePath() : this.resPath;
|
||||||
var realUrl = this.getUrl(basePath, url);
|
var realUrl = this.getUrl(basePath, url);
|
||||||
return loader.load(realUrl, url);
|
return loader.load(realUrl, url);
|
||||||
|
|
Loading…
Reference in New Issue