for_each_string_list_item: avoid undefined behavior for empty list