Skip to content

Commit

Permalink
Fix exception on empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
padix-key committed Dec 19, 2024
1 parent 0606f17 commit 64a96b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def create_switcher_json(file_path, min_tag, n_versions):
}
)
# Mark the latest version as preferred
version_config[-1]["preferred"] = True
if len(version_config) > 0:
version_config[-1]["preferred"] = True
with open(file_path, "w") as file:
json.dump(version_config, file, indent=4)

0 comments on commit 64a96b8

Please sign in to comment.