Skip to content

Commit ff3f889

Browse files
committed
scripting: fix crash when an invalid VM is found
1 parent 7217aa5 commit ff3f889

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Platform/macOS/AppDelegate.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@
3737
guard let data = data else {
3838
return []
3939
}
40-
return data.virtualMachines.map { vm in
41-
UTMScriptingVirtualMachineImpl(for: vm, data: data)
40+
return data.virtualMachines.compactMap { vm in
41+
if vm.wrapped != nil {
42+
return UTMScriptingVirtualMachineImpl(for: vm, data: data)
43+
} else {
44+
return nil
45+
}
4246
}
4347
}
4448

0 commit comments

Comments
 (0)