瀏覽代碼

vm(qemu): do not set mouse if index is invalid

osy 1 周之前
父節點
當前提交
bb26fe2264
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Services/UTMQemuVirtualMachine.swift

+ 3 - 0
Services/UTMQemuVirtualMachine.swift

@@ -726,6 +726,9 @@ extension UTMQemuVirtualMachine {
         }
         do {
             let index = try await monitor.mouseIndex(forAbsolute: tablet)
+            guard index > -1 else {
+                return
+            }
             try await monitor.mouseSelect(index)
             ioService?.primaryInput?.requestMouseMode(!tablet)
         } catch {