Fix buffer overrun.

The code relied on the check being done higher up, which it isn't any
more.