Selaa lähdekoodia

Merge commit '37cdeea363754642f88cd321731e9d4d6622159e' into Rpc

Frank van den Bos 2 vuotta sitten
vanhempi
commit
662cdb3bf3
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      InABox.Core/Serialization.cs

+ 2 - 2
InABox.Core/Serialization.cs

@@ -653,7 +653,7 @@ namespace InABox.Core
         public static void WriteObject<TObject>(this CoreBinaryWriter writer, TObject entity, Type type)
             where TObject : BaseObject
         {
-            if (!type.IsAssignableFrom(typeof(TObject)))
+            if (!typeof(TObject).IsAssignableFrom(type))
                 throw new Exception($"{type.EntityName()} is not a subclass of {typeof(TObject).EntityName()}");
 
             var properties = SerializableProperties(type).ToList();
@@ -682,7 +682,7 @@ namespace InABox.Core
         public static TObject ReadObject<TObject>(this CoreBinaryReader reader, Type type)
             where TObject : BaseObject
         {
-            if (!type.IsAssignableFrom(typeof(TObject)))
+            if (!typeof(TObject).IsAssignableFrom(type))
                 throw new Exception($"{type.EntityName()} is not a subclass of {typeof(TObject).EntityName()}");
 
             var obj = (Activator.CreateInstance(type) as TObject)!;