Fix crash when buckets is null

This commit is contained in:
pythongosssss
2023-08-22 13:46:26 +01:00
parent aba58fa353
commit a045085d42
+5 -3
View File
@@ -51,9 +51,11 @@ class LoraInfoDialog extends ComfyDialog {
get resolutions() {
let res = [];
if (this.#metadata.ss_bucket_info) {
const { buckets } = JSON.parse(this.#metadata.ss_bucket_info);
for (const { resolution, count } of Object.values(buckets)) {
res.push([count, `${resolution.join("x")} * ${count}`]);
const parsed = JSON.parse(this.#metadata.ss_bucket_info);
if (parsed?.buckets) {
for (const { resolution, count } of Object.values(parsed.buckets)) {
res.push([count, `${resolution.join("x")} * ${count}`]);
}
}
}
res = res.sort((a, b) => b[0] - a[0]).map((a) => a[1]);