Closed ursasenior closed 1 year ago
Thanks for reporting @ursasenior.
@Wil-B,
I have wrapped it with an if condition to prevent this from happening:
o = this.cache[key];
if (o && o.img === 'called') {
o.img = $Lib.gr(this.cellWidth * n, this.cellWidth * n, true, g => this.createCollage(g, this.cellWidth, this.cellWidth, n, n, cells));
if (this.style.image == 2) this.circularMask(o.img, o.img.Width, o.img.Height);
o.img = o.img.Resize(this.im.w, this.im.w, 7);
if (ppt.albumArtLabelType == 3) this.fadeMask(o.img, o.img.Width, o.img.Height);
}
panel.treePaint();
@Wil-B,
I have applied this fix, never had this issue so it's a rare init case. Downside for this fix, the user will have a blank album art root image thumbnail when this issue occurs. I didn't want to waste too much time, but if you have a better fix, please let me know... Thanks!
-TT
With your fix, when the root image is set to collage the images didn't seem to draw for me.
Likely the cause of the error is that o.img failed to create because of an invalid width or height, although the original code is supposed to guard against that.
Simplest fix seems to be to check for the existence of o.img. However, I can't reproduce the issue so the below fix is untested.
checkRootImg() {
const key = pop.tree.length ? pop.tree[0].key : null;
if (!key) return;
let o = this.cache[key];
const imgsAvailable = Math.min(Math.round((this.panel.h + this.row.h) / this.row.h) * this.columns, pop.tree.length) - 1;
let n = Math.max(Math.min(Math.floor(Math.sqrt(imgsAvailable)), Infinity), 2); // auto set collage size: limited by no imgs available (per screen): reduce by changing infinity
const cells = Math.pow(n, 2);
this.rootNo = n * n + 1;
if (!o) this.cache[key] = {
img: 'called',
accessed: ++this.accessed
}
o = this.cache[key];
o.img = $.gr(this.cellWidth * n, this.cellWidth * n, true, g => this.createCollage(g, this.cellWidth, this.cellWidth, n, n, cells));
if (o.img) { // fix for TT img error
if (this.style.image == 2) this.circularMask(o.img, o.img.Width, o.img.Height);
o.img = o.img.Resize(this.im.w, this.im.w, 7);
if (ppt.albumArtLabelType == 3) this.fadeMask(o.img, o.img.Width, o.img.Height);
}
panel.treePaint();
}
Ok, I'll put it beneath collage, thanks!
Encountered this error in v3.0-RC1 after the following steps:
File: images.js Line: 273, Column: 3 Stack trace: checkRootImg@images.js:273:3 metrics@images.js:1198:38 load@images.js:1015:8 rootNodes@library.js:1001:35 initialise@library.js:524:8 initMain/<@gr-callbacks.js:673:8