Fixed crash when the reponse object is null

This fixes a crash when obj is null, which happens pretty often when obj is the result of a mongo query.