From 7d0c7be1913ae395101d2ee6367938d0a1b2be35 Mon Sep 17 00:00:00 2001 From: Xpl0itU <24777100+Xpl0itU@users.noreply.github.com> Date: Fri, 21 Jul 2023 15:05:30 +0200 Subject: [PATCH] Handle error on decryption when it's menu option --- cmd/WiiUDownloader/mainwindow.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/WiiUDownloader/mainwindow.go b/cmd/WiiUDownloader/mainwindow.go index fa42669..9c84d04 100644 --- a/cmd/WiiUDownloader/mainwindow.go +++ b/cmd/WiiUDownloader/mainwindow.go @@ -192,7 +192,14 @@ func (mw *MainWindow) ShowAll() { selectedPath := dialog.FileChooser.GetFilename() mw.progressWindow.Window.ShowAll() - go mw.onDecryptContentsMenuItemClicked(selectedPath) + go func() { + err := mw.onDecryptContentsMenuItemClicked(selectedPath) + if err != nil { + glib.IdleAdd(func() { + mw.showError(err) + }) + } + }() }) toolsSubMenu.Append(decryptContentsMenuItem) @@ -389,10 +396,11 @@ func (mw *MainWindow) onCategoryToggled(button *gtk.ToggleButton) { button.Activate() } -func (mw *MainWindow) onDecryptContentsMenuItemClicked(selectedPath string) { - wiiudownloader.DecryptContents(selectedPath, &mw.progressWindow, false) +func (mw *MainWindow) onDecryptContentsMenuItemClicked(selectedPath string) error { + err := wiiudownloader.DecryptContents(selectedPath, &mw.progressWindow, false) mw.progressWindow.Window.Close() + return err } func (mw *MainWindow) isSelectionInQueue() bool {