From c7c4b0807a15bc96c9a5fdc7116062b721bb555f Mon Sep 17 00:00:00 2001 From: Jaex Date: Wed, 15 Sep 2021 03:08:41 +0300 Subject: [PATCH] fixed #5816: Handle illegal output file path --- ShareX.MediaLib/Forms/VideoConverterForm.cs | 28 +++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/ShareX.MediaLib/Forms/VideoConverterForm.cs b/ShareX.MediaLib/Forms/VideoConverterForm.cs index 09d01bdd7..d8a2c2b5d 100644 --- a/ShareX.MediaLib/Forms/VideoConverterForm.cs +++ b/ShareX.MediaLib/Forms/VideoConverterForm.cs @@ -136,7 +136,14 @@ private void UpdateOptions() if (!Options.UseCustomArguments) { - txtArguments.Text = Options.GetFFmpegArgs(); + try + { + txtArguments.Text = Options.GetFFmpegArgs(); + } + catch + { + txtArguments.Text = ""; + } } lblVideoCodec.Visible = cbVideoCodec.Visible = !Options.UseCustomArguments; @@ -159,13 +166,20 @@ private bool StartEncoding() ffmpeg.TrackEncodeProgress = true; ffmpeg.EncodeProgressChanged += Manager_EncodeProgressChanged; - string outputFilePath = Options.OutputFilePath; - string args = Options.Arguments; - result = ffmpeg.Run(args); - - if (Options.AutoOpenFolder && result && !ffmpeg.StopRequested) + try { - Helpers.OpenFolderWithFile(outputFilePath); + string outputFilePath = Options.OutputFilePath; + string args = Options.Arguments; + result = ffmpeg.Run(args); + + if (Options.AutoOpenFolder && result && !ffmpeg.StopRequested) + { + Helpers.OpenFolderWithFile(outputFilePath); + } + } + catch (Exception e) + { + e.ShowError(); } } }