Check for bad indices, with option to either error (default) or return 0.0