remove some fatal vioelent exits

This commit is contained in:
ycc
2026-02-02 18:58:08 +01:00
parent 353ef42752
commit 9e0751e0d0
2 changed files with 6 additions and 8 deletions

View File

@@ -2,7 +2,6 @@ package helpers
import ( import (
"errors" "errors"
"log"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
@@ -159,7 +158,7 @@ func ReadMessage(messageFilename string) ([]string, []string, string, error) {
if _, err := os.Stat(filepath.Join(client.GetConfig().StoragePath, identity.Uuid, "files")); os.IsNotExist(err) { if _, err := os.Stat(filepath.Join(client.GetConfig().StoragePath, identity.Uuid, "files")); os.IsNotExist(err) {
err = os.MkdirAll(filepath.Join(client.GetConfig().StoragePath, identity.Uuid, "files"), 0700) err = os.MkdirAll(filepath.Join(client.GetConfig().StoragePath, identity.Uuid, "files"), 0700)
if err != nil { if err != nil {
log.Fatal(err) return nil, nil, "ReadMessage: MkdirAll", err
} }
} }
for _, file := range usermsg.Files { for _, file := range usermsg.Files {

View File

@@ -8,7 +8,6 @@ import (
"image/color" "image/color"
"image/png" "image/png"
"io" "io"
"log"
"math" "math"
"os" "os"
@@ -101,7 +100,7 @@ func (contact *ContactCard) WriteCompressed(filename string) error {
return nil return nil
} }
func (contact *ContactCard) WritePng(filename string) { func (contact *ContactCard) WritePng(filename string) error {
out, err := proto.Marshal(contact) out, err := proto.Marshal(contact)
if err != nil { if err != nil {
println(err) println(err)
@@ -128,18 +127,18 @@ func (contact *ContactCard) WritePng(filename string) {
f, err := os.Create(filename) f, err := os.Create(filename)
if err != nil { if err != nil {
log.Fatal(err) return err
} }
if err := png.Encode(f, img); err != nil { if err := png.Encode(f, img); err != nil {
f.Close() f.Close()
log.Fatal(err) return err
} }
if err := f.Close(); err != nil { if err := f.Close(); err != nil {
log.Fatal(err) return err
} }
return nil
} }
func (Contact *ContactCard) WriteQr(filename string) error { func (Contact *ContactCard) WriteQr(filename string) error {