From d2279cc376bd657edbf8b534b9f9f9f2805f5acb Mon Sep 17 00:00:00 2001 From: Yasuhiro Inami Date: Tue, 8 Oct 2019 21:31:59 +0900 Subject: [PATCH] Fix `KqueueSelector` crash --- Sources/KqueueSelector.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/KqueueSelector.swift b/Sources/KqueueSelector.swift index e8d2817..2455078 100644 --- a/Sources/KqueueSelector.swift +++ b/Sources/KqueueSelector.swift @@ -167,7 +167,9 @@ public final class KqueueSelector: Selector { } fileDescriptorIOEvents[fileDescriptor] = ioEvents } - return Array(fileDescriptorIOEvents.map { (fileDescriptorMap[$0.0]!, $0.1) }) + return Array(fileDescriptorIOEvents.compactMap { event in + fileDescriptorMap[event.0].map { ($0, event.1) } ?? nil + }) } public subscript(fileDescriptor: Int32) -> SelectorKey? {