Skip to content

Commit

Permalink
FIX: Crash on bad type field
Browse files Browse the repository at this point in the history
  • Loading branch information
d-krupke committed Nov 29, 2023
1 parent 5ae1742 commit 6fa4b93
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ you to modify and use the code for the competition.

## Changelog

- **1.2.2:** Previous fix did not work sufficiently. Fixed it now (hopefully).
- **1.2.1:** Fixing Issue #2 and a crash when the `type` field is missing.
- **1.2.0:** Fixing catching of exception of bad files at the wrong place. Improved error messages.
- **1.1.1:** A long on Windows is only 32bit, so changed to using the explicit `int64_t` type.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def readme():

setup( # https://scikit-build.readthedocs.io/en/latest/usage.html#setup-options
name="cgshop2024_pyutils",
version="1.2.1",
version="1.2.2",
author="Dominik Krupke",
license="LICENSE",
description="Utilities for verifying solutions of the CG:SHOP 2024 Competition.",
Expand Down
2 changes: 1 addition & 1 deletion src/cgshop2024_pyutils/io/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def parse_solution(data: typing.Dict):
msg = "Solution must be a dictionary. If your JSON-file is a list of solutions, please split it into multiple files."
raise BadSolutionFile(msg)
# make sure this is a proper solution file
if data.get("type", None).lower() != "cgshop2024_solution":
if not isinstance(data.get("type", None), str) or data["type"].lower() != "cgshop2024_solution":
msg = "Not a CGSHOP2024 solution file"
raise NoSolution(msg)
if "id" in data and "instance" not in data:
Expand Down

0 comments on commit 6fa4b93

Please sign in to comment.