Fixed NPE when there are no definitions set

This commit is contained in:
Toastie 2025-02-04 20:00:15 +13:00
parent 38bf5e0d2f
commit 79009a659d
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
2 changed files with 2 additions and 2 deletions

View file

@ -136,7 +136,7 @@ public class InterviewTemplateCommands
List<string> errors = [];
List<string> warnings = [];
template.interview.Validate(ref errors, ref warnings, "interview", template.definitions);
foreach (KeyValuePair<string, InterviewStep> definition in template.definitions)
foreach (KeyValuePair<string, InterviewStep> definition in template.definitions ?? [])
{
definition.Value.Validate(ref errors, ref warnings, "definitions." + definition.Key, template.definitions);
}

View file

@ -223,6 +223,6 @@
}
}
},
"required": [ "category-id", "interview" ],
"required": [ "category-id", "interview", "definitions" ],
"unevaluatedProperties": false
}