Skip to content

Commit

Permalink
Check if channel has been created before updating the object menu
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Nov 27, 2023
1 parent 8e2e7e0 commit 36a06e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bit-systems/object-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ function handleHeldExit(world: HubsWorld, eid: EntityID, menuEid: EntityID) {
}

function updateVisibility(world: HubsWorld, menu: EntityID, frozen: boolean) {
if (!APP.hubChannel) return;
let target = ObjectMenu.targetRef[menu];
const visible = !!(target && frozen) && (ObjectMenu.flags[menu] & ObjectMenuFlags.Visible) !== 0;

Expand All @@ -243,8 +244,8 @@ function updateVisibility(world: HubsWorld, menu: EntityID, frozen: boolean) {
const mediaLoader = findAncestorWithComponent(world, MediaContentBounds, target);
target = mediaLoader ? mediaLoader : target;

const canISpawnMove = APP.hubChannel!.can("spawn_and_move_media");
const canIPin = !!(target && canPin(APP.hubChannel!, target));
const canISpawnMove = APP.hubChannel.can("spawn_and_move_media");
const canIPin = !!(target && canPin(APP.hubChannel, target));
const isEntityPinned = isPinned(target);

// Parent visibility doesn't block raycasting, so we must set each button to be invisible
Expand Down

0 comments on commit 36a06e5

Please sign in to comment.