Skip to content

Commit 2083141

Browse files
authored
Merge pull request #3485 from pandamicro/develop
Fix duplicated loading will overwrite image into loader cache
2 parents 450cf33 + 7bf6632 commit 2083141

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: cocos2d/core/platform/CCLoaders.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@ cc._imgLoader = {
4848
load: function (realUrl, url, res, cb) {
4949
var callback;
5050
if (cc.loader.isLoading(realUrl)) {
51-
callback = cb;
51+
callback = function (err, img) {
52+
if (err)
53+
return cb(err);
54+
var tex = cc.textureCache.getTextureForKey(url) || cc.textureCache.handleLoadedTexture(url, img);
55+
cb(null, tex);
56+
};
5257
}
5358
else {
5459
callback = function (err, img) {
5560
if (err)
5661
return cb(err);
57-
5862
var tex = cc.textureCache.handleLoadedTexture(url, img);
5963
cb(null, tex);
6064
};

0 commit comments

Comments
 (0)