forked from loafle/openapi-generator-original
Fix npe when unwrapping optional. (#12882)
This commit is contained in:
parent
f176716a61
commit
8fded5c47e
@ -353,8 +353,8 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user