Skip to content

Commit 7265310

Browse files
committed
fix dockable crash
1 parent 0f34835 commit 7265310

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/OneWare.Core/Services/MainDockService.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,13 @@ public override void FloatDockable(IDockable dockable)
130130
base.FloatDockable(dockable);
131131
}
132132

133-
public override void CloseDockable(IDockable dockable)
133+
public override void CloseDockable(IDockable? dockable)
134134
{
135+
// When closing a floating window in Windows, the method might get called with a null dockable
136+
// This is likely a bug with the dock library
137+
// We check it to prevent a crash
138+
if (dockable == null) return;
139+
135140
try
136141
{
137142
base.CloseDockable(dockable);
@@ -149,9 +154,9 @@ public override void CloseDockable(IDockable dockable)
149154
}
150155
}
151156

152-
private void SafeRemoveDockable(IDockable dockable)
157+
private void SafeRemoveDockable(IDockable? dockable)
153158
{
154-
if (dockable.Owner is IDock { VisibleDockables: { } dockables } &&
159+
if (dockable?.Owner is IDock { VisibleDockables: { } dockables } &&
155160
dockables.Contains(dockable))
156161
{
157162
dockables.Remove(dockable);

0 commit comments

Comments
 (0)