Another fix for "Don't write empty indexes"

Change-Id: Ifdf6c2945d2100957b10c4f7fc0eebef99ec1129