Skip to content

Commit

Permalink
Cancleing file dialog produces nil w
Browse files Browse the repository at this point in the history
  • Loading branch information
ubavic committed Dec 21, 2024
1 parent dd5de7e commit 3b2f739
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/gui/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ func savePdf(doc document.Document) func() {
}

dialog := dialog.NewFileSave(func(w fyne.URIWriteCloser, err error) {
if w == nil || err != nil {
if err != nil {
setStatus("error.writingPdf", fmt.Errorf("writing PDF: %w", err))
return
}

if w == nil {
return
}

saveLastUsedDirectory(w.URI())

_, err = w.Write(pdf)
Expand Down Expand Up @@ -73,11 +77,15 @@ func saveXlsx(doc document.Document) func() {
}

dialog := dialog.NewFileSave(func(w fyne.URIWriteCloser, err error) {
if w == nil || err != nil {
if err != nil {
setStatus("error.writingXlsx", fmt.Errorf("writing xlsx: %w", err))
return
}

if w == nil {
return
}

saveLastUsedDirectory(w.URI())

_, err = w.Write(excel)
Expand Down

0 comments on commit 3b2f739

Please sign in to comment.