Fix a panic when failing to load some images in a diff

This commit is contained in:
Kovid Goyal
2023-05-24 22:41:51 +05:30
parent d3fc8a2897
commit 5b199b28c3

View File

@@ -138,7 +138,9 @@ func (self *ImageCollection) ResizeForPageSize(width, height int) {
ctx.Parallel(0, len(keys), func(nums <-chan int) {
for i := range nums {
img := self.images[keys[i]]
img.ResizeForPageSize(width, height)
if img.src.loaded && img.err == nil {
img.ResizeForPageSize(width, height)
}
}
})
}
@@ -298,6 +300,7 @@ func (self *ImageCollection) LoadAll() {
if img.err == nil {
img.src.size.Width, img.src.size.Height = img.src.data.Width, img.src.data.Height
}
img.src.loaded = true
}
}
})