Skip to content

Commit 9f02fd1

Browse files
committed
fix(shared): getData
1 parent f9e00c8 commit 9f02fd1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

api/AltV.Net.EntitySync/Entity.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ public bool TryGetData<T>(string key, out T value)
194194
}
195195
catch
196196
{
197+
if (currValue is T cast)
198+
{
199+
value = cast;
200+
return true;
201+
}
202+
197203
value = default;
198204
return false;
199205
}

api/AltV.Net.Shared/Elements/Entities/SharedBaseObject.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ public bool GetData<T>(string key, out T result)
4848
}
4949
catch
5050
{
51+
if (value is T cast)
52+
{
53+
result = cast;
54+
return true;
55+
}
56+
5157
result = default;
5258
return false;
5359
}

0 commit comments

Comments
 (0)