Skip to content

Commit

Permalink
Fix type check for enums.
Browse files Browse the repository at this point in the history
isadorasophia committed Oct 13, 2024
1 parent f29d381 commit 5431963
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Murder/Data/Save/BlackboardTracker.cs
Original file line number Diff line number Diff line change
@@ -385,10 +385,12 @@ private T GetValue<T>(BlackboardInfo info, string fieldName) where T : notnull
return GetValue<T>(fieldName);
}

GameLogger.Verify(f.FieldType == typeof(T) || typeof(T) == typeof(object),
object? value = f.GetValue(info.Blackboard);

GameLogger.Verify(f.FieldType.IsEnum || f.FieldType == typeof(T) || typeof(T) == typeof(object),
"Wrong type for dialog variable!");

return (T)f.GetValue(info.Blackboard)!;
return (T)value!;
}

/// <summary>

0 comments on commit 5431963

Please sign in to comment.