mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
Avoid crash in new waveform code
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1612 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
561150b8bc
commit
79ed00571f
@ -331,16 +331,25 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
if (_wavePeaks != null && _wavePeaks.AllSamples != null)
|
||||
{
|
||||
List<Paragraph> selectedParagraphs = new List<Paragraph>();
|
||||
foreach (int index in _selectedIndices)
|
||||
if (_selectedIndices != null)
|
||||
{
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(index);
|
||||
if (p != null)
|
||||
try
|
||||
{
|
||||
foreach (int index in _selectedIndices)
|
||||
{
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(index);
|
||||
if (p != null)
|
||||
{
|
||||
p = new Paragraph(p);
|
||||
// not really frames... just using them as position markers for better performance
|
||||
p.StartFrame = (int)(p.StartTime.TotalSeconds * _wavePeaks.Header.SampleRate * _zoomFactor);
|
||||
p.EndFrame = (int)(p.EndTime.TotalSeconds * _wavePeaks.Header.SampleRate * _zoomFactor);
|
||||
selectedParagraphs.Add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
p = new Paragraph(p);
|
||||
// not really frames... just using them as position markers for better performance
|
||||
p.StartFrame = (int)(p.StartTime.TotalSeconds * _wavePeaks.Header.SampleRate * _zoomFactor);
|
||||
p.EndFrame = (int)(p.EndTime.TotalSeconds * _wavePeaks.Header.SampleRate * _zoomFactor);
|
||||
selectedParagraphs.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user