Fix coverity warning for null pointer.

Instead, throw an IOException since something has gone wrong reading the
file.