Skip to content

Commit f6ec93b

Browse files
committed
handle dead hero case
1 parent 0e66f4e commit f6ec93b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/vscripts/GameMode.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export class GameMode {
4343

4444
// Also apply the panic modifier to the sending player's hero
4545
const hero = player.GetAssignedHero();
46-
hero.AddNewModifier(hero, undefined, modifier_panic.name, { duration: 5 });
46+
if (hero != undefined) { // Hero didn't spawn yet or dead
47+
hero.AddNewModifier(hero, undefined, modifier_panic.name, { duration: 5 });
48+
}
4749
});
4850
}
4951

0 commit comments

Comments
 (0)