Skip to content

Commit bdd1461

Browse files
committed
potential bug
1 parent 8de932e commit bdd1461

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

codeflash/optimization/function_optimizer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,10 @@ def determine_best_candidate(
719719
# TODO: better way to resolve conflicts with same min ranking
720720
overall_ranking = {key: diff_lens_ranking[key] + runtimes_ranking[key] for key in diff_lens_ranking}
721721
min_key = min(overall_ranking, key=overall_ranking.get)
722-
else:
722+
elif len(optimization_ids) == 1:
723723
min_key = 0 # only one candidate in valid _opts, already returns if there are no valid candidates
724+
else: # 0? shouldn't happen but it's there to escape potential bugs
725+
return None
724726
best_optimization = valid_candidates_with_shorter_code[min_key]
725727
# reassign code string which is the shortest
726728
ai_service_client.log_results(

0 commit comments

Comments
 (0)