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