Add null check to ctx.response.body.