Skip to content

Commit 50ec8a5

Browse files
committed
Fix null checking in focus events.
1 parent b11ed83 commit 50ec8a5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Rubberduck.VBEEditor/WindowsApi/CodePaneSubclass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal CodePaneSubclass(IntPtr hwnd, ICodePane pane) : base(hwnd)
1919
protected override void DispatchFocusEvent(FocusType type)
2020
{
2121
var window = VBENativeServices.GetWindowInfoFromHwnd(Hwnd);
22-
if (window == null)
22+
if (!window.HasValue)
2323
{
2424
return;
2525
}

Rubberduck.VBEEditor/WindowsApi/FocusSource.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using Rubberduck.Common.WinAPI;
33
using Rubberduck.VBEditor.Events;
4+
using Rubberduck.VBEditor.SafeComWrappers.MSForms;
45

56
namespace Rubberduck.VBEditor.WindowsApi
67
{
@@ -20,7 +21,7 @@ protected void OnFocusChange(WindowChangedEventArgs eventArgs)
2021
protected virtual void DispatchFocusEvent(FocusType type)
2122
{
2223
var window = VBENativeServices.GetWindowInfoFromHwnd(Hwnd);
23-
if (window == null)
24+
if (!window.HasValue)
2425
{
2526
return;
2627
}

0 commit comments

Comments
 (0)