From 7c8d7a23886dd6a15e9bc4807b78c18fe93cf3c1 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Tue, 6 Dec 2016 16:37:20 -0600 Subject: [PATCH] Fixed crash when unpacking NDS ROMs in ToolkitForm --- DotNet3dsToolkit/Misc/GenericNDSRom.vb | 6 +++++- ToolkitForm/Form1.vb | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/DotNet3dsToolkit/Misc/GenericNDSRom.vb b/DotNet3dsToolkit/Misc/GenericNDSRom.vb index 47ea782..76c5f3f 100644 --- a/DotNet3dsToolkit/Misc/GenericNDSRom.vb +++ b/DotNet3dsToolkit/Misc/GenericNDSRom.vb @@ -640,7 +640,11 @@ Public Class GenericNDSRom ''' Public ReadOnly Property ExtractionProgress As Single Implements IReportProgress.Progress Get - Return CurrentExtractProgress / CurrentExtractMax + If CurrentExtractMax = 0 Then + Return 0 + Else + Return CurrentExtractProgress / CurrentExtractMax + End If End Get End Property diff --git a/ToolkitForm/Form1.vb b/ToolkitForm/Form1.vb index 61bff3e..80b933d 100644 --- a/ToolkitForm/Form1.vb +++ b/ToolkitForm/Form1.vb @@ -84,11 +84,16 @@ Public Class Form1 End Sub Private Sub OnUnpackProgressedInternal(sender As Object, e As ProgressReportedEventArgs) - If pbProgress.Style = ProgressBarStyle.Marquee Then + If e.IsIndeterminate OrElse e.Progress = Single.NaN Then + pbProgress.Style = ProgressBarStyle.Marquee + Else pbProgress.Style = ProgressBarStyle.Continuous End If - pbProgress.Value = e.Progress * pbProgress.Maximum + If Not SIngle.IsNaN(e.Progress) Then + pbProgress.Value = e.Progress * pbProgress.Maximum + End If + lblStatus.Text = String.Format("Extracting...") End Sub