Throw IAE if indices is null or contains a null value.

Closes #2656