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
+5 -2

No files matched your search

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