Allow for null names in presence events

Leave events may leave the presence metadata fields null, including
name. Fall back on an empty string if that is the case.
This commit is contained in:
Correl Roush 2020-05-30 14:08:21 -04:00
parent 1e9080e7c1
commit 129f249ca2

View file

@ -514,7 +514,11 @@ playersDecoder =
let let
presence = presence =
Decode.map2 (Player Participant) Decode.map2 (Player Participant)
(Decode.field "name" Decode.string) (Decode.field "name"
(Decode.nullable Decode.string
|> Decode.map (Maybe.withDefault "")
)
)
(Decode.field "vote" (Decode.nullable Decode.string)) (Decode.field "vote" (Decode.nullable Decode.string))
in in
Decode.dict presence Decode.dict presence