Require a grid description for hats grid

Without this, you can cause a null-pointer dereference by passing Loopy
a game description with no grid description, like "10x10t16:".
This commit is contained in:
Ben Harris
2023-03-31 15:33:51 +01:00
parent e6aa7ab6dd
commit 52d801a06a

3
grid.c
View File

@ -3496,6 +3496,9 @@ static const char *grid_validate_desc_hats(
struct HatPatchParams hp; struct HatPatchParams hp;
const char *error = NULL; const char *error = NULL;
if (!desc)
return "Missing grid description string.";
error = grid_desc_to_hat_params(desc, &hp); error = grid_desc_to_hat_params(desc, &hp);
if (!error) if (!error)
error = hat_tiling_params_invalid(&hp); error = hat_tiling_params_invalid(&hp);