Guard a potentially unsafe array index computation.

Potentially fixes #36