Fix crash when gen blank video with no sub

This commit is contained in:
niksedk 2022-07-15 16:38:54 +02:00
parent 5490b38132
commit 913308c390

View File

@ -28,7 +28,13 @@ namespace Nikse.SubtitleEdit.Forms
UiUtil.FixFonts(this);
numericUpDownDurationMinutes.Value = Configuration.Settings.Tools.BlankVideoMinutes;
var maxTimeP = subtitle?.Paragraphs.Where(p => !p.EndTime.IsMaxTime).Max(p => p.EndTime.TotalMilliseconds);
double? maxTimeP = null;
if (subtitle?.Paragraphs != null && subtitle.Paragraphs.Count > 0)
{
maxTimeP = subtitle?.Paragraphs.Where(p => !p.EndTime.IsMaxTime).Max(p => p.EndTime.TotalMilliseconds);
}
if (maxTimeP.HasValue && maxTimeP.Value / 1000 > 120)
{
var minutes = (int)maxTimeP.Value / 1000 / 60 + 1;