Fixed possible crash when saving ebu + now saves language code - thx Richard :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@733 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-10-18 19:17:53 +00:00
parent 0d741203ca
commit df1f23c0bb
2 changed files with 6 additions and 0 deletions

View File

@ -159,6 +159,9 @@ namespace Nikse.SubtitleEdit.Forms
_header.DiskFormatCode = "STL25.01";
_header.CharacterCodeTableNumber = "0" + comboBoxCharacterCodeTable.SelectedIndex.ToString();
_header.LanguageCode = textBoxLanguageCode.Text;
if (_header.LanguageCode.Length != 2)
_header.LanguageCode = "0A";
_header.OriginalProgrammeTitle = textBoxOriginalProgramTitle.Text.PadRight(32, ' ');
_header.OriginalEpisodeTitle = textBoxOriginalEpisodeTitle.Text.PadRight(32, ' ');
_header.TranslatedProgrammeTitle = textBoxTranslatedProgramTitle.Text.PadRight(32, ' ');

View File

@ -411,6 +411,9 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
public void Save(string fileName, Subtitle subtitle)
{
if (fileName.Length > 32)
fileName = fileName.Substring(0, 32).Trim();
EbuGeneralSubtitleInformation header = new EbuGeneralSubtitleInformation();
EbuSaveOptions saveOptions = new EbuSaveOptions();
if (subtitle.Header != null && subtitle.Header.Length > 1024 && (subtitle.Header.Contains("STL25") || subtitle.Header.Contains("STL30")))