Backport 1.8 3715

Backport #3715, `BUG: Fix 0-sized ndindex`.