Skip to content

Commit

Permalink
[Sdk] Just ignore types that dont have the required attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
wannkunstbeikor committed Oct 28, 2023
1 parent 6f20eb9 commit 42d8852
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion FrostySdk/TypeLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ public static bool Initialize()
for (int i = 0; i < s_types.Length; i++)
{
Type type = s_types[i];

NameHashAttribute? nameHashAttribute = type.GetCustomAttribute<NameHashAttribute>();
if (nameHashAttribute is null)
{
// issue described in #25 we are just ignoring these cases
continue;
}
uint nameHash = nameHashAttribute.Hash;
string name = type.GetCustomAttribute<DisplayNameAttribute>()?.Name ?? type.Name;
uint nameHash = type.GetCustomAttribute<NameHashAttribute>()!.Hash; // every type should have that attribute
Guid? guid = type.GetCustomAttribute<GuidAttribute>()?.Guid;

s_nameMapping.Add(name, i);
Expand Down

0 comments on commit 42d8852

Please sign in to comment.