Improve handling of empty indices in indices view

(cherry picked from commit 37429c655a0aeafa6284f263b33c05aac519b851)