#14128 Fix cc.loader.getRes crash caused by null type

This commit is contained in:
pandamicro 2015-10-22 01:16:56 +08:00
parent 9eeda122e9
commit d3664b9616
1 changed files with 2 additions and 1 deletions

View File

@ -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);