修复空组导致 cocos creator 编辑器崩溃

This commit is contained in:
onvia 2023-09-14 17:06:58 +08:00
parent 037e598d81
commit dbef180d51
3 changed files with 7 additions and 1 deletions

View File

@ -1359,6 +1359,9 @@
return true; return true;
} }
resize() { resize() {
if (!this.children.length) {
return;
}
let left = Number.MAX_SAFE_INTEGER; let left = Number.MAX_SAFE_INTEGER;
let right = Number.MIN_SAFE_INTEGER; let right = Number.MIN_SAFE_INTEGER;
let top = Number.MAX_SAFE_INTEGER; let top = Number.MAX_SAFE_INTEGER;

View File

@ -7,7 +7,7 @@
"build": "tsc -b", "build": "tsc -b",
"watch": "tsc -w", "watch": "tsc -w",
"rollup": "rollup -c", "rollup": "rollup -c",
"test": "ts-node src/index.ts --force-img --input ./test/scale-demo.psd --project-assets ./out/ --cache ./cache/cache.json --output ./out/", "test": "ts-node src/index.ts --engine-version v342 --force-img --input ./test/blank.psd --project-assets ./out/ --cache ./cache/cache.json --output ./out/",
"help": "node dist/index.js --h", "help": "node dist/index.js --h",
"test-init": "node dist/index.js --init --project-assets ./out/ --cache E:\\Git\\ccc-framework-3d\\tools\\psd2ui\\cache\\cache.json", "test-init": "node dist/index.js --init --project-assets ./out/ --cache E:\\Git\\ccc-framework-3d\\tools\\psd2ui\\cache\\cache.json",
"test-png9": "ts-node src/index.ts --engine-version v342 --pinyin --input ./test/png9.psd --output ./out/", "test-png9": "ts-node src/index.ts --engine-version v342 --pinyin --input ./test/png9.psd --output ./out/",

View File

@ -24,6 +24,9 @@ export class PsdGroup extends PsdLayer {
} }
resize() { resize() {
if(!this.children.length){
return;
}
let left = Number.MAX_SAFE_INTEGER; let left = Number.MAX_SAFE_INTEGER;
let right = Number.MIN_SAFE_INTEGER; let right = Number.MIN_SAFE_INTEGER;
let top = Number.MAX_SAFE_INTEGER; let top = Number.MAX_SAFE_INTEGER;