mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Don't throw NullReferenceException and instead use nullable type
This commit is contained in:
parent
61d69f8399
commit
50ce50eae1
2 changed files with 5 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue