From c7a43a7b2b0f9debbaa94b2ff9c69a0e6889c220 Mon Sep 17 00:00:00 2001 From: WenyunSun Date: Sat, 17 Aug 2024 11:03:53 +0800 Subject: [PATCH] no message --- ContextMenuManager/Methods/ObjectPath.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ContextMenuManager/Methods/ObjectPath.cs b/ContextMenuManager/Methods/ObjectPath.cs index 2cbb4fa4..0db2123e 100644 --- a/ContextMenuManager/Methods/ObjectPath.cs +++ b/ContextMenuManager/Methods/ObjectPath.cs @@ -36,7 +36,14 @@ public static bool GetFullFilePath(string fileName, out string fullPath) if(File.Exists(fullPath)) return true; } - fullPath = Registry.GetValue($@"{RegAppPath}\{name}", "", null)?.ToString(); + try + { + fullPath = Registry.GetValue($@"{RegAppPath}\{name}", "", null)?.ToString(); + } + catch (System.ArgumentException) // Prevent name errors exceeding 255 characters + { + return false; + } if(File.Exists(fullPath)) return true; } fullPath = null;