From c94b8b875d9a3dbd2db5d90f5c3f5aaeb62f7ea6 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 4 Dec 2010 13:10:20 +0000 Subject: [PATCH] Fix in Visual Sync: if end-time is after video length, end-pos will be video length - 2 secs git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@175 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Forms/VisualSync.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Forms/VisualSync.cs b/src/Forms/VisualSync.cs index c4eeedf2c..02153a932 100644 --- a/src/Forms/VisualSync.cs +++ b/src/Forms/VisualSync.cs @@ -95,7 +95,15 @@ namespace Nikse.SubtitleEdit.Forms mediaPlayer.Pause(); if (index != -1) { - mediaPlayer.CurrentPosition = _paragraphs[index].StartTime.TotalMilliseconds/1000.0; + double indexPositionInSeconds = _paragraphs[index].StartTime.TotalMilliseconds / 1000.0; + + if (indexPositionInSeconds > mediaPlayer.Duration) + indexPositionInSeconds = mediaPlayer.Duration - (2 * 60); + + if (indexPositionInSeconds < 0) + indexPositionInSeconds = 0; + + mediaPlayer.CurrentPosition = indexPositionInSeconds; mediaPlayer.RefreshProgressBar(); } }