From 305caf35f93cdd0df0871dee0edda0cdcbf9872b Mon Sep 17 00:00:00 2001 From: Xpl0itU <24777100+Xpl0itU@users.noreply.github.com> Date: Fri, 11 Aug 2023 18:19:19 +0200 Subject: [PATCH] Fix some decryption crashes --- decryption.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/decryption.go b/decryption.go index 6640f19..4a56a6c 100644 --- a/decryption.go +++ b/decryption.go @@ -15,6 +15,7 @@ extern void callProgressCallback(int progress); import "C" import ( "fmt" + "time" "unsafe" "github.com/gotk3/gotk3/gtk" @@ -37,10 +38,13 @@ func DecryptContents(path string, progress *ProgressWindow, deleteEncryptedConte progress.bar.SetText("Decrypting...") for progressInt := range progressChan { - progress.bar.SetFraction(float64(progressInt) / 100) - for gtk.EventsPending() { - gtk.MainIteration() + if progressInt > 0 { + progress.bar.SetFraction(float64(progressInt) / 100) + for gtk.EventsPending() { + gtk.MainIteration() + } } + time.Sleep(time.Millisecond * 10) } if err := <-errorChan; err != nil {