Fix: guard load_plugins() so helper files without a default export don't crash tool init

selection_actions.js uses named exports only (no default export).
load_plugins() was calling new classObj.default(ctx) on every file in tools/,
causing TypeError which aborted render_main_tools() -> render_main_gui() ->
leaving menu and toolbar blank. Added null guard and per-file try/catch,
matching the defensive pattern already added to load_modules().

https://claude.ai/code/session_01WVDg7amsy1TTtxvpku7bcM
This commit is contained in:
Claude
2026-06-13 23:04:10 +00:00
parent 2a0c414a1c
commit 34d9f5aafc
+5
View File
@@ -46,7 +46,9 @@ class GUI_tools_class {
moduleKey = parts[parts.length - 1];
}
try {
var classObj = plugins_context(key);
if (!classObj.default) return; // skip helper files without a default export
var object = new classObj.default(ctx);
var title = _this.Helper.ucfirst(object.name);
@@ -64,6 +66,9 @@ class GUI_tools_class {
if(typeof object.load != "undefined") {
object.load();
}
} catch(e) {
console.error('[load_plugins] Failed to load ' + key + ':', e);
}
}
});
}