mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 06:52:35 +01:00
Tried to fix possible error/crash when loading bad time codes - thx Jucá :)
This commit is contained in:
parent
a2d4e20b32
commit
9723ae4d3c
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Controls
|
||||
{
|
||||
@ -53,7 +53,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
double? millisecs = GetTotalMilliseconds();
|
||||
if (millisecs.HasValue)
|
||||
{
|
||||
if (millisecs.Value == TimeCode.MaxTime.TotalMilliseconds)
|
||||
if (millisecs.Value >= TimeCode.MaxTime.TotalMilliseconds - 0.1)
|
||||
millisecs = 0;
|
||||
|
||||
if (Mode == TimeMode.HHMMSSMS)
|
||||
@ -194,7 +194,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.TotalMilliseconds == TimeCode.MaxTime.TotalMilliseconds)
|
||||
if (value.TotalMilliseconds >= TimeCode.MaxTime.TotalMilliseconds - 0.1)
|
||||
{
|
||||
maskedTextBox1.Text = string.Empty;
|
||||
return;
|
||||
|
@ -8082,14 +8082,20 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (Configuration.Settings.General.UseTimeFormatHHMMSSFF)
|
||||
{
|
||||
int wholeSeconds = (int)seconds;
|
||||
int frames = SubtitleFormat.MillisecondsToFrames(seconds % 1.0 * 1000);
|
||||
int frames = SubtitleFormat.MillisecondsToFrames(seconds % 1.0 * 1000.0);
|
||||
int extraSeconds = (int)(frames / Configuration.Settings.General.CurrentFrameRate);
|
||||
int restFrames = (int)(frames % Configuration.Settings.General.CurrentFrameRate);
|
||||
numericUpDownDuration.Value = (decimal)(wholeSeconds + extraSeconds + restFrames / 100.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
numericUpDownDuration.Value = (decimal)seconds;
|
||||
var d = (decimal) seconds;
|
||||
if (d > numericUpDownDuration.Maximum)
|
||||
numericUpDownDuration.Value = numericUpDownDuration.Maximum;
|
||||
else if (d < numericUpDownDuration.Minimum)
|
||||
numericUpDownDuration.Value = numericUpDownDuration.Minimum;
|
||||
else
|
||||
numericUpDownDuration.Value = d;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user