Fix bug 1031485 - Prevent undefined variable access

We got some stack traces that showed the body being undefined. This adds a check to prevent against that.