diff --git a/ShareX.HelpersLib/CursorData.cs b/ShareX.HelpersLib/CursorData.cs index 9b7d48512..36929054b 100644 --- a/ShareX.HelpersLib/CursorData.cs +++ b/ShareX.HelpersLib/CursorData.cs @@ -111,17 +111,11 @@ public static float GetCursorSizeMultiplier() { float sizeMultiplier = 1f; - try - { - int cursorSize = RegistryHelpers.GetValueDWord(@"SOFTWARE\Microsoft\Accessibility", "CursorSize"); + int? cursorSize = RegistryHelpers.GetValueDWord(@"SOFTWARE\Microsoft\Accessibility", "CursorSize"); - if (cursorSize > 1) - { - sizeMultiplier = 1f + ((cursorSize - 1) * 0.5f); - } - } - catch + if (cursorSize != null && cursorSize > 1) { + sizeMultiplier = 1f + (((int)cursorSize - 1) * 0.5f); } return sizeMultiplier; diff --git a/ShareX.HelpersLib/Helpers/RegistryHelpers.cs b/ShareX.HelpersLib/Helpers/RegistryHelpers.cs index c1cd8d02e..8fe1e82a5 100644 --- a/ShareX.HelpersLib/Helpers/RegistryHelpers.cs +++ b/ShareX.HelpersLib/Helpers/RegistryHelpers.cs @@ -107,9 +107,9 @@ public static string GetValueString(string path, string name = null, RegistryHiv return GetValue(path, name, root, view) as string; } - public static int GetValueDWord(string path, string name = null, RegistryHive root = RegistryHive.CurrentUser, RegistryView view = RegistryView.Default) + public static int? GetValueDWord(string path, string name = null, RegistryHive root = RegistryHive.CurrentUser, RegistryView view = RegistryView.Default) { - return (int)GetValue(path, name, root, view); + return (int?)GetValue(path, name, root, view); } public static bool CheckStringValue(string path, string name = null, string value = null, RegistryHive root = RegistryHive.CurrentUser, RegistryView view = RegistryView.Default)