From 6323937c3048fda0e7038983f89184e4ffb7e69b Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Tue, 30 Apr 2024 12:41:32 +0100 Subject: [PATCH] Refactor video dimension validation in GenerateVideoWithHardSubs This commit refactors the validation of video dimensions in GenerateVideoWithHardSubs class. Instead of checking width and height separately, a new Dimension object is created and validated with IsValid(). This simplifies the code and improves readability. Signed-off-by: Ivandro Jao --- src/ui/Forms/GenerateVideoWithHardSubs.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index d527d64df..4664d3b7e 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -2202,14 +2202,15 @@ namespace Nikse.SubtitleEdit.Forms vInfo = UiUtil.GetVideoInfo(videoFileName); } - if (vInfo.Width == 0 || vInfo.Height == 0) + var dimension = new Dimension(vInfo.Height, vInfo.Width); + + // skip audio or damaged files + if (!dimension.IsValid()) { SeLogger.Error("Skipping burn-in file with no video: " + videoFileName); - // return; // skip audio or damaged files - return new Dimension(); } - return new Dimension(vInfo.Height, vInfo.Width); + return dimension; } private void deleteToolStripMenuItem_Click(object sender, EventArgs e)