diff --git a/Potatso/Core/API.swift b/Potatso/Core/API.swift index 00caddbd..43ed4d0a 100644 --- a/Potatso/Core/API.swift +++ b/Potatso/Core/API.swift @@ -244,14 +244,17 @@ extension Alamofire.DataRequest { let JSONToMap: AnyObject? if let keyPath = keyPath, keyPath.isEmpty == false { + // issue: see Code Notices at Github's front page, still no time to pay attention to this issue yet... //JSONToMap = (result.value? as AnyObject).value(forKeyPath: keyPath) JSONToMap = nil } else { JSONToMap = result.value as AnyObject? } - if let parsedObject = Mapper().mapArray(JSONArray: JSONToMap as! [[String : Any]]){ - return .success(parsedObject) + if (JSONToMap != nil) { + if let parsedObject = Mapper().mapArray(JSONArray: JSONToMap as! [[String : Any]]){ + return .success(parsedObject) + } } let failureReason = "ObjectMapper failed to serialize response."