From 08aa9f2a62bbf09e85b02cdd22b0907bd1f5e132 Mon Sep 17 00:00:00 2001 From: Cacsjep <98898150+Cacsjep@users.noreply.github.com> Date: Tue, 23 Jan 2024 20:08:54 +0100 Subject: [PATCH] Fix Errors in scale example --- examples/scaling/main.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/examples/scaling/main.go b/examples/scaling/main.go index 6f2acf5..4f16588 100644 --- a/examples/scaling/main.go +++ b/examples/scaling/main.go @@ -56,21 +56,19 @@ func main() { defer swsCtx.Free() err = swsCtx.Scale(srcFrame, dstFrame) - if err != nil { - log.Fatalf("Unable to scale: %w", err) - } + log.Fatalf("Unable to scale: %s", err.Error()) + } - img, err := dstFrame.Data().Image() + img, err := dstFrame.Data().Image() + if err != nil { + log.Fatalf("Unable to get image: %s", err.Error()) + } - if err != nil { - log.Fatalf("Unable to get image: %w", err) - } - - err = png.Encode(dstFile, img) - if err != nil { - log.Fatalf("Unable to encode image to png: %w", err) - } + err = png.Encode(dstFile, img) + if err != nil { + log.Fatalf("Unable to encode image to png: %s", err.Error()) + } log.Printf("Successfully scale to %dx%d and write image to: %s", dstWidth, dstHeight, dstFilename) }