From e4af6def2de4a37342c6eb303f908f74c647c5de Mon Sep 17 00:00:00 2001 From: thompsonate Date: Sun, 12 May 2019 16:50:06 -0700 Subject: [PATCH] try to get more useful errors for crashing bug tmandry/AXSwift/11 --- Pods/AXSwift/Sources/UIElement.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Pods/AXSwift/Sources/UIElement.swift b/Pods/AXSwift/Sources/UIElement.swift index fcc3f8d..ee45471 100644 --- a/Pods/AXSwift/Sources/UIElement.swift +++ b/Pods/AXSwift/Sources/UIElement.swift @@ -178,7 +178,15 @@ open class UIElement { throw error } - return (unpackAXValue(value!) as! T) + guard let unwrapped = value else { + fatalError("attribute \(attribute) of \(self) was nil") + } + + let unpacked = unpackAXValue(unwrapped) + guard let casted = unpacked as? T else { + fatalError("attribute \(attribute) of \(self) was unexpected type: \(String(describing: value))") + } + return casted } /// Sets the value of `attribute` to `value`.