mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-21 18:52:36 +01:00
Fix possible crash in "Gen transparent subs" when using video from "Program files"
This commit is contained in:
parent
4237f39a9f
commit
bd3497f23a
@ -1246,7 +1246,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
FileUtil.WriteAllText(assaTempFileName, format.ToText(subtitle, null), new TextEncoding(Encoding.UTF8, "UTF8"));
|
||||
try
|
||||
{
|
||||
FileUtil.WriteAllText(assaTempFileName, format.ToText(subtitle, null), new TextEncoding(Encoding.UTF8, "UTF8"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// might be a write protected folder, so we try the temp folder
|
||||
assaTempFileName = Path.Combine(Path.GetTempPath(), Path.GetFileName(assaTempFileName));
|
||||
FileUtil.WriteAllText(assaTempFileName, format.ToText(subtitle, null), new TextEncoding(Encoding.UTF8, "UTF8"));
|
||||
}
|
||||
|
||||
var videoFileName = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.mp4");
|
||||
var result = RunOnePassEncoding(assaTempFileName, subtitle, videoFileName);
|
||||
|
Loading…
Reference in New Issue
Block a user