From ff3f889874e524b3d7c9a7ea8e74c792bc756bad Mon Sep 17 00:00:00 2001 From: osy <50960678+osy@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:34:08 -0800 Subject: [PATCH] scripting: fix crash when an invalid VM is found --- Platform/macOS/AppDelegate.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Platform/macOS/AppDelegate.swift b/Platform/macOS/AppDelegate.swift index 7dbbf51d4..140d56a7d 100644 --- a/Platform/macOS/AppDelegate.swift +++ b/Platform/macOS/AppDelegate.swift @@ -37,8 +37,12 @@ guard let data = data else { return [] } - return data.virtualMachines.map { vm in - UTMScriptingVirtualMachineImpl(for: vm, data: data) + return data.virtualMachines.compactMap { vm in + if vm.wrapped != nil { + return UTMScriptingVirtualMachineImpl(for: vm, data: data) + } else { + return nil + } } }