Skip to content

Commit 68dba4a

Browse files
committed
fix(serialization): Fixed an issue with serializing non nullable values
1 parent d6a8bf6 commit 68dba4a

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

MLAPI/Data/TypeExtensions.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ internal static bool HasInterface(this Type type, Type interfaceType)
1515
return false;
1616
}
1717

18-
internal static bool IsNullable<T>(this T obj)
19-
{
20-
if (obj == null) return true;
21-
22-
return typeof(T).IsNullable();
23-
}
24-
2518
internal static bool IsNullable(this Type type)
2619
{
2720
if (!type.IsValueType) return true; // ref-type

MLAPI/NetworkingManagerComponents/Binary/BitWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void SetStream(Stream stream)
4646
/// <param name="value">The object to write</param>
4747
public void WriteObjectPacked(object value)
4848
{
49-
if (value.IsNullable())
49+
if (value == null || value.GetType().IsNullable())
5050
{
5151
WriteBool(value == null);
5252

0 commit comments

Comments
 (0)