Closed lucidium4 closed 1 month ago
Can you narrow this down to a smaller test case?
Here's the code thats causing the exceptions
javaScriptHandler.js
import FileHandler from "assets://widgets/dock/explorer/fileHandler.js";
export default class JavaScriptHandler extends FileHandler {
extension = ".js";
icon = "assets://FugueIcons/icons/script-code.png";
openFile(path) {
if (path == null || path == undefined) {
console.error("Path is null or undefined");
return;
}
console.log("Opening JavaScript file: " + path);
if (this.core == null || this.core == undefined) {
console.error("Core is null or undefined");
return;
}
let fileName;
if (path) {
fileName = path.split("/").pop()
}
console.log
if (this.explorer != null || this.explorer != undefined) {
this.core.controller.loadPreloadedWidgetToWorkspace('scriptEditor');
}
}
}
/core/controller.js
loadPreloadedWidget(widgetName, rootNode){
const preloadedWidget = this.model.preloadedWidgets[widgetName];
const model = preloadedWidget.model;
const view = preloadedWidget.view;
const controller = preloadedWidget.controller;
const widget = new WidgetMVC.Widget(model, view, controller, rootNode, this.widget, true);
//widget.parent = this.widget;
//return widget;
}
/widgetmvc.js
export class Widget {
model = null;
view = null;
controller = null;
parent = null;
constructor(m = null, v = null, c = null, rootNode = RootNode, parent = null, assetIo = AssetIo) {
this.parent = parent;
this.model = new m();
this.view = new v(rootNode, assetIo);
this.controller = new c();
this.model.setController(this.controller);
this.view.setController(this.controller);
this.controller.setModel(this.model);
this.controller.setView(this.view);
this.model.widget = this;
this.view.widget = this;
this.controller.widget = this;
this.model.awake();
this.view.awake();
this.controller.awake();
}
The bug seems to occur when trying to instantiate a class from an es module
This needs a proper repro without need to learn a game engine and a system on top of that. Can not fix otherwise.
I found a workaround on my End
Version used
3.1.3
Describe the bug
Calling a function in another object with args Triggers a NullReferenceException
To Reproduce
REDACTED
Expected behavior
A clear and concise description of what you expected to happen.
The expect behavior would be Once the file is clicked A Widget should Open In Tabed Area in the Center.
Additional context
I'm current writing the editor for my game engine in JavaScript Running on top of Jint. The Editor is Designed with a modular approach using MVC-based Widgets
Add any other context about the problem here. no.