Skip to content

Commit 46b5262

Browse files
fix(ui): Handle missing UI injection point
1 parent 6286fd8 commit 46b5262

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/kitten-scientists/source/ui/UserInterface.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { isNil, mustExist } from "@oliversalzburg/js-utils/lib/nil.js";
22
import { UserScript, ksVersion } from "../UserScript.js";
33
import { Icons } from "../images/Icons.js";
4+
import { cwarn } from "../tools/Log.js";
45
import { BonfireSettingsUi } from "./BonfireSettingsUi.js";
56
import { EngineSettingsUi } from "./EngineSettingsUi.js";
67
import { InternalsUi } from "./InternalsUi.js";
@@ -73,6 +74,7 @@ export class UserInterface extends UiComponent {
7374
const optionsListElement = $("<ul/>");
7475
optionsListElement.append(this._engineUi.element);
7576
this._sections.forEach(section => optionsListElement.append(section.element));
77+
ks.append(optionsListElement);
7678

7779
// Make _engineUI's expando button hide/show the other option groups
7880
const expando = this._engineUi.expando;
@@ -114,9 +116,13 @@ export class UserInterface extends UiComponent {
114116

115117
$("#clearLog").prepend(this.showActivity);
116118

117-
// add the options above the game log
119+
// Add Kitten Scientists above the game log.
118120
const right = $("#rightColumn");
119-
right.prepend(ks.append(optionsListElement));
121+
if (right.attr("id") === undefined) {
122+
cwarn("Unable to find right column to inject UI into. Running headless.");
123+
} else {
124+
right.prepend(ks);
125+
}
120126

121127
this.element = ks;
122128
}

0 commit comments

Comments
 (0)