From 79f5098b024c268255a98162bfa2a190b8b3e9ec Mon Sep 17 00:00:00 2001 From: huiyadanli Date: Thu, 19 May 2022 23:36:03 +0800 Subject: [PATCH] =?UTF-8?q?[#]=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E7=89=88=E6=9C=AC=E5=88=A4=E6=96=AD=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RevokeMsgPatcher/Utils/FileUtil.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/RevokeMsgPatcher/Utils/FileUtil.cs b/RevokeMsgPatcher/Utils/FileUtil.cs index 0e18c60..8e0d04b 100644 --- a/RevokeMsgPatcher/Utils/FileUtil.cs +++ b/RevokeMsgPatcher/Utils/FileUtil.cs @@ -16,8 +16,16 @@ namespace RevokeMsgPatcher.Utils /// public static string GetFileVersion(string path) { - FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(path); - return fileVersionInfo.FileVersion; + if (File.Exists(path)) + { + FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(path); + return fileVersionInfo.FileVersion; + } + else + { + return null; + } + } ///