MidLevel / Ruffles

Lightweight and fully managed reliable UDP library.
MIT License
212 stars 28 forks source link

Calling GetCurrentRtt with invalid clientId throws exception #27

Closed dbircsak closed 3 years ago

dbircsak commented 3 years ago

When calling GetCurrentRtt with an invalid clientId causes an exception two different ways:

KeyNotFoundException: The given key was not present in the dictionary. System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at :0) RufflesTransport.RufflesTransport.GetCurrentRtt (System.UInt64 clientId) (at C:/projects/mlapi-transports/RufflesTransport/RufflesTransport.cs:281)

NullReferenceException: Object reference not set to an instance of an object RufflesTransport.RufflesTransport.GetRufflesConnectionDetails (System.UInt64 clientId, System.UInt64& connectionId) (at C:/projects/mlapi-transports/RufflesTransport/RufflesTransport.cs:332) RufflesTransport.RufflesTransport.GetCurrentRtt (System.UInt64 clientId) (at C:/projects/mlapi-transports/RufflesTransport/RufflesTransport.cs:279)

Could GetCurrentRtt simply not throw an exception but rather return 0?

TwoTenPvP commented 3 years ago

This is a issue for the https://github.com/midlevel/MLAPI.Transports repo as Ruffles itself does not have this issue.