Open MarSoft opened 1 year ago
Looks like it does not stop iterating even after true
is returned which should denote Stop iterating
.
And here is the (dirty) workaround I currently use:
<snip>
fmt.Println("Scanning images")
var imgFound image.Image
func() {
defer func() {
if e := recover(); e == 42 {
fmt.Println("Got 42")
} else if e != nil {
panic(e)
}
}()
err = ass.ImageWalker(func(name string, img image.Image) bool {
fmt.Println("Got img", name)
imgFound = img
panic(42)
})
}()
fmt.Println("Img res", err, imgFound)
}
A bit of explanation: when the desired image is found, my walker function saves it and panic
s. The outer function reccover
s from that panic and returns gracefully. As a result, the hanging code is just bypassed.
But this won't work if the library hangs before finding the desired image.
When I try to use
github.com/iineva/bom/pkg/asset
to load App Icon fromAssets.car
file of the following ipa: https://github.com/StreamerApp/Streamer/releases/download/1.2.24/Streamer-tvOS.ipa it first finds the icon and then hangs and eats all the memory. Here is the example code to reproduce the issue:Actual output: