Make sure response exists before checking statusCode