mirror of https://github.com/ppy/osu
Fix SignalR messagepack formatter potentially initializing on iOS
This commit is contained in:
parent
d397524878
commit
0342923408
|
@ -35,7 +35,9 @@ public class SignalRUnionWorkaroundResolver : IFormatterResolver
|
|||
typeof(TeamVersusUserState),
|
||||
};
|
||||
|
||||
private static readonly IReadOnlyDictionary<Type, IMessagePackFormatter> formatter_map = new Dictionary<Type, IMessagePackFormatter>
|
||||
private static IReadOnlyDictionary<Type, IMessagePackFormatter> formatterMapBacking;
|
||||
|
||||
private static IReadOnlyDictionary<Type, IMessagePackFormatter> formatterMap => formatterMapBacking ??= new Dictionary<Type, IMessagePackFormatter>
|
||||
{
|
||||
{ typeof(TeamVersusUserState), new TypeRedirectingFormatter<TeamVersusUserState, MatchUserState>() },
|
||||
{ typeof(TeamVersusRoomState), new TypeRedirectingFormatter<TeamVersusRoomState, MatchRoomState>() },
|
||||
|
@ -51,7 +53,7 @@ public class SignalRUnionWorkaroundResolver : IFormatterResolver
|
|||
|
||||
public IMessagePackFormatter<T> GetFormatter<T>()
|
||||
{
|
||||
if (formatter_map.TryGetValue(typeof(T), out var formatter))
|
||||
if (formatterMap.TryGetValue(typeof(T), out var formatter))
|
||||
return (IMessagePackFormatter<T>)formatter;
|
||||
|
||||
return StandardResolver.Instance.GetFormatter<T>();
|
||||
|
|
Loading…
Reference in New Issue