Ezaldeen99 / BackgroundRemoval

Background Removal written with swift using u2net model
Apache License 2.0
204 stars 34 forks source link

Nullability crash #8

Closed AlbertRenshaw closed 11 months ago

AlbertRenshaw commented 1 year ago

let out = UIImage(pixelBuffer: result!.out_p1)

This line causes entire app to crash with certain images.

Recommend switching corresponding lines to:

guard let in0 = buffer(from: resize) else {
            return nil
        }
        guard let result = try? model?.prediction(in_0: in0) else {
            return nil
        }
        guard let out = UIImage(pixelBuffer: result.out_p1) else {
            return nil
        }
Ezaldeen99 commented 1 year ago

Hello sorry for answering with latency, and thanks for the info. will try to fix this asap

Ezaldeen99 commented 11 months ago

Fixed by #10