Skip to content

Commit

Permalink
Merge branch 'fix_crash'
Browse files Browse the repository at this point in the history
  • Loading branch information
haxpor committed Apr 1, 2017
2 parents bb4930f + c60888f commit d74e711
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Potatso/Core/API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>().mapArray(JSONArray: JSONToMap as! [[String : Any]]){
return .success(parsedObject)
if (JSONToMap != nil) {
if let parsedObject = Mapper<T>().mapArray(JSONArray: JSONToMap as! [[String : Any]]){
return .success(parsedObject)
}
}

let failureReason = "ObjectMapper failed to serialize response."
Expand Down

0 comments on commit d74e711

Please sign in to comment.