From e621b21c883f453f93b4e9f8790ae43d8cd0f12e Mon Sep 17 00:00:00 2001 From: thefiddler Date: Tue, 23 Sep 2014 08:55:02 +0200 Subject: [PATCH] [Win] Avoid NRE in WinFactory.Dispose() WinFactory.Dispose() could crash with a NRE when the joystick driver has not been initialized. Fixed by checking for null before disposing the input driver. --- Source/OpenTK/Platform/Windows/WinFactory.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/OpenTK/Platform/Windows/WinFactory.cs b/Source/OpenTK/Platform/Windows/WinFactory.cs index d09b4de2..6f57024e 100644 --- a/Source/OpenTK/Platform/Windows/WinFactory.cs +++ b/Source/OpenTK/Platform/Windows/WinFactory.cs @@ -163,7 +163,12 @@ namespace OpenTK.Platform.Windows { if (manual) { - rawinput_driver.Dispose(); + WinRawInput raw = rawinput_driver; + if (raw != null) + { + raw.Dispose(); + rawinput_driver = null; + } } base.Dispose(manual);