Catch some pathological cases inside oinspect

Closes gh-2577
Merge pull request #3484 from takluyver/i2577

Catch some pathological cases inside oinspect