Skip to content

Commit

Permalink
fix update loop error
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Apr 22, 2023
1 parent aaafdfc commit 115d457
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ARKBreedingStats/values/Values.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public bool LoadModValues(IEnumerable<string> modFilesToLoad, bool throwExceptio

string filename = FileService.GetJsonPath(Path.Combine(FileService.ValuesFolder, modFileToLoad));

if (TryLoadValuesFile(filename, true, false, out ValuesFile modValues, out string modFileErrorMessage))
if (TryLoadValuesFile(filename, true, false, out var modValues, out var modFileErrorMessage, true))
{
modifiedValues.Add(modValues);
}
Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/values/ValuesFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ protected static ValuesFile LoadValuesFile(string filePath)
/// If the mod-values will be used, setModFileName should be true.
/// If the file cannot be found or the format is wrong, the file is ignored and no exception is thrown if throwExceptionOnFail is false.
/// </summary>
protected static bool TryLoadValuesFile(string filePath, bool setModFileName, bool throwExceptionOnFail, out ValuesFile values, out string errorMessage)
protected static bool TryLoadValuesFile(string filePath, bool setModFileName, bool throwExceptionOnFail, out ValuesFile values, out string errorMessage, bool checkIfModPropertyIsExisting = false)
{
values = null;
errorMessage = null;
try
{
values = LoadValuesFile(filePath);
if (string.IsNullOrEmpty(values.mod?.id))
if (checkIfModPropertyIsExisting && string.IsNullOrEmpty(values.mod?.id))
{
errorMessage =
$"The mod file\n{filePath}\ndoesn't contains an object \"mod\" or that object doesn't contain a valid entry \"id\". The mod file cannot be loaded until this information is added";
Expand Down

0 comments on commit 115d457

Please sign in to comment.