fix: json receive null data
parent
476851bf4f
commit
5f9e8f0b66
|
@ -43,7 +43,6 @@ namespace GadGame.Network
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void GetReceiveData()
|
||||
{
|
||||
while (_receiving)
|
||||
|
@ -55,7 +54,11 @@ namespace GadGame.Network
|
|||
var buffer = new byte[1024];
|
||||
var bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||
var jsonData = Encoding.ASCII.GetString(buffer, 0, bytesRead);
|
||||
_dataReceived = JsonConvert.DeserializeObject<ReceiverData>(jsonData);
|
||||
_dataReceived = JsonConvert.DeserializeObject<ReceiverData>(jsonData, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue