Skip to content

Commit 3c9515f

Browse files
committed
Fixed a bug about throw error
1 parent 06dcfeb commit 3c9515f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cocos2d/core/sprites/CCSprite.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ delete cc._tmp.PrototypeSprite;
983983
};
984984

985985
manager.prototype.add = function (source, callback, target) {
986+
if (!source || !source.addEventListener) return;
986987
source.addEventListener('load', callback, target);
987988
this.list.push({
988989
source: source,
@@ -991,6 +992,7 @@ delete cc._tmp.PrototypeSprite;
991992
});
992993
};
993994
manager.prototype.once = function (source, callback, target) {
995+
if (!source || !source.addEventListener) return;
994996
var tmpCallback = function (event) {
995997
source.removeEventListener('load', tmpCallback, target);
996998
callback.call(target, event);

0 commit comments

Comments
 (0)