Skip to content

Commit 99f0fb6

Browse files
author
James
committed
prevent crash if weapon's bullets have not yet been initialized before settting _bulletClass
1 parent 639b916 commit 99f0fb6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/plugins/weapon/WeaponPlugin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,8 +1127,10 @@ Object.defineProperty(Phaser.Weapon.prototype, "bulletClass", {
11271127

11281128
this._bulletClass = classType;
11291129

1130-
this.bullets.classType = this._bulletClass;
1131-
1130+
//prevent crash if weapon's bullets have not yet been initialized
1131+
if (this.bullets) {
1132+
this.bullets.classType = this._bulletClass;
1133+
}
11321134
}
11331135

11341136
});

0 commit comments

Comments
 (0)