Skip to content

Commit

Permalink
Fix script schema retrieval in ScriptHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
marklundin committed Nov 6, 2024
1 parent 7dd4b9a commit 24e35ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/framework/handlers/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ScriptHandler extends ResourceHandler {
import(importUrl.toString()).then((module) => {

const filename = importUrl.pathname.split('/').pop();
const scriptSchema = this._app.assets.find(filename, 'script').data.scripts;
const scriptSchema = this._app.assets.find(filename, 'script')?.data?.scripts;

for (const key in module) {
const scriptClass = module[key];
Expand All @@ -153,7 +153,7 @@ class ScriptHandler extends ResourceHandler {
registerScript(scriptClass, scriptName);

// Store any schema associated with the script
this._app.scripts.addSchema(scriptName, scriptSchema[scriptName]);
if (scriptSchema) this._app.scripts.addSchema(scriptName, scriptSchema[scriptName]);
}
}

Expand Down

0 comments on commit 24e35ea

Please sign in to comment.