fix optional array

This commit is contained in:
codetypes committed 2025-04-11 11:40:37 +08:00
1 parent 45624c6869
commit 8198c19c7c
3 files changed
+8 -5

No files matched your search

+1
View File
@@ -137,6 +137,7 @@ async function createWindow(projectPath?: string) {
trafficLightPosition: { x: 10, y: 10 }, trafficLightPosition: { x: 10, y: 10 },
webPreferences: { webPreferences: {
preload, preload,
webSecurity: false,
// Warning: Enable nodeIntegration and disable contextIsolation is not secure in production // Warning: Enable nodeIntegration and disable contextIsolation is not secure in production
// Consider using contextBridge.exposeInMainWorld // Consider using contextBridge.exposeInMainWorld
// Read more on https://www.electronjs.org/docs/latest/tutorial/context-isolation // Read more on https://www.electronjs.org/docs/latest/tutorial/context-isolation
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> <!-- <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> -->
<title>Behavior3 Editor</title> <title>Behavior3 Editor</title>
</head> </head>
<body> <body>
+6 -4
View File
@@ -267,11 +267,13 @@ export const checkNodeArg = (
const arg = conf.args![i] as NodeArg; const arg = conf.args![i] as NodeArg;
const value = data.args?.[arg.name]; const value = data.args?.[arg.name];
if (isNodeArgArray(arg)) { if (isNodeArgArray(arg)) {
if (!Array.isArray(value) || (!isNodeArgOptional(arg) && value.length === 0)) { if (!Array.isArray(value) || value.length === 0) {
if (verbose) { if (!isNodeArgOptional(arg)) {
error(data, `'${arg.name}=${JSON.stringify(value)}' is not an array or empty array`); if (verbose) {
error(data, `'${arg.name}=${JSON.stringify(value)}' is not an array or empty array`);
}
hasError = true;
} }
hasError = true;
} else { } else {
for (let j = 0; j < value.length; j++) { for (let j = 0; j < value.length; j++) {
if (!checkNodeArgValue(data, arg, value[j], verbose)) { if (!checkNodeArgValue(data, arg, value[j], verbose)) {