catch err

This commit is contained in:
2025-11-25 22:06:53 +01:00
parent 5d4f8c0cb1
commit a259adfdd3

View File

@@ -22,6 +22,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"log"
"math/big" "math/big"
mathrand "math/rand" mathrand "math/rand"
"os" "os"
@@ -141,7 +142,11 @@ func Encrypt(c *Conf, filename string) error {
if err != nil { if err != nil {
return err return err
} }
defer outfile.Close() defer func() {
if err := outfile.Close(); err != nil {
log.Fatal(err)
}
}()
key, err := GetRandomKey() key, err := GetRandomKey()
if err != nil { if err != nil {