Skip to content

Commit

Permalink
bugfix: having my unit destroyed was crashing client as ownerPlayer.c…
Browse files Browse the repository at this point in the history
…ontrol became null
  • Loading branch information
m0dE committed Mar 26, 2021
1 parent ea5aff3 commit 1e62406
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion engine/core/IgeEntity.js
Original file line number Diff line number Diff line change
Expand Up @@ -5211,7 +5211,7 @@ var IgeEntity = IgeObject.extend({
// instantly rotate unit to mouse cursor
if (this == ige.client.selectedUnit) {
var ownerPlayer = ige.$(this._stats.ownerId);
if (ownerPlayer) {
if (ownerPlayer && ownerPlayer.control && ownerPlayer.control.input) {
var mouse = ownerPlayer.control.input.mouse;
if (mouse) {
this.angleToTarget = Math.atan2(mouse.y - this._translate.y, mouse.x - this._translate.x) + Math.radians(90);
Expand Down

0 comments on commit 1e62406

Please sign in to comment.