Skip to content

this.world() returning null #1758

@rickmcgeer

Description

@rickmcgeer

What would you like to achieve?
I was debugging with the console when I saw the error:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'halos')
    at DashboardControl.DashboardControl_slideIn_ (side-bar.cp.js:387:21)

The code was here:

$world.execCommand("open browser", {moduleName: "studio/side-bar.cp.js", packageName: "engageLively--galyleo-dashboard", codeEntity: "slideOut"});

And here:

$world.execCommand("open browser", {moduleName: "studio/side-bar.cp.js", packageName: "engageLively--galyleo-dashboard", codeEntity: "slideIn"});

The offending line was:

world.halos().forEach(h => h.maskBounds = world.getHaloMask());

world was null, and it had been set a few lines before with world = this.world().
I fixed it by wrapping it in a null check, but I guess the author of the original code (@merryman ) thought that this.world() couldn't be null, so I wanted to check if there was a deeper issue.

How are you trying to achieve that

Alternative solutions
If applicable, what other solutions have you tried?

Additional Resources
Please provide links to any custom code that might be necessary to grasp your problem. Screenshots of custom component, etc. are also appreciated.

Version: Please paste the lively.next commit on which the problem occurred here (use the copy button of the Version Checker in the bottom left corner).
c725a77

Metadata

Metadata

Assignees

No one assigned

    Labels

    📟 support inquiryQuestions that can be answered without changing code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions