Avoiding access to non existent indexes