Merge pull request #327 from hexagonhexagon/b-key-dev-fix

Fix issue where pressing B just after loading crashes the game.
This commit is contained in:
tobspr 2020-06-28 10:31:12 +02:00 committed by GitHub
commit 4a56c3ccba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -106,13 +106,14 @@ export class HubGoals extends BasicSerializableObject {
// Allow quickly switching goals in dev mode // Allow quickly switching goals in dev mode
if (G_IS_DEV) { if (G_IS_DEV) {
if (G_IS_DEV) { window.addEventListener("keydown", ev => {
window.addEventListener("keydown", ev => { if (ev.key === "b") {
if (ev.key === "b") { // root is not guaranteed to exist within ~0.5s after loading in
if (this.root && this.root.app && this.root.app.gameAnalytics) {
this.onGoalCompleted(); this.onGoalCompleted();
} }
}); }
} });
} }
} }