Merge pull request #828 from ItsCalebJones/bugfix/parsing_error

Fix parsing crash on null value.
This commit is contained in:
Lorenzo Pichilli 2022-04-15 20:16:41 +02:00 committed by GitHub
commit d1aa8b0281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -16,8 +16,10 @@ public class Options<T>: NSObject {
func parse(options: [String: Any?]) -> Options {
for (key, value) in options {
if value != nil, !(value is NSNull), self.responds(to: Selector(key)) {
self.setValue(value, forKey: key)
if value != nil, !(value is NSNull) {
if self.responds(to: Selector(key)) {
self.setValue(value, forKey: key)
}
}
}
return self