0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-23 19:55:18 +00:00

fix: KeyNotFoundException

KeyNotFoundException: The given key 'time' was not present in the dictionary.
This commit is contained in:
Robin C. Ladiges 2024-04-27 23:07:40 +02:00 committed by Sanae
parent 4de654b6e4
commit 497b5b44d6

View file

@ -101,8 +101,8 @@ public class Client : IDisposable {
}
public TagPacket? GetTagPacket() {
var time = (Time?) this.Metadata?["time"];
var seek = (bool?) this.Metadata?["seeking"];
var time = (Time?) (this.Metadata.ContainsKey("time") ? this.Metadata["time"] : null);
var seek = (bool?) (this.Metadata.ContainsKey("seeking") ? this.Metadata["seeking"] : null);
if (time == null && seek == null) { return null; }
return new TagPacket {
UpdateType = (seek != null ? TagPacket.TagUpdate.State : 0) | (time != null ? TagPacket.TagUpdate.Time: 0),