Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] JSON decoder not properly decoding defaultConfigurationIsVisible in some projects #593

Merged
merged 5 commits into from
Nov 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ extension KeyedDecodingContainer {
}

func decodeIntIfPresent(_ key: KeyedDecodingContainer.Key) throws -> UInt? {
guard let string: String = try decodeIfPresent(key) else {
if let string: String = try? decodeIfPresent(key) {
return UInt(string)
} else if let bool: Bool = try decodeIfPresent(key) {
// don't `try?` here in case key _does_ exist but isn't an expected type
// ie. not a string/bool
return bool ? 0 : 1
} else {
return nil
}
return UInt(string)
}

func decodeIntBool(_ key: KeyedDecodingContainer.Key) throws -> Bool {
Expand Down