fix(emqx_bridge): don't crash if there's no status field

This commit is contained in:
Stefan Strigler 2023-11-02 16:49:50 +01:00
parent fe783788e0
commit 4fe1d332b3
1 changed files with 7 additions and 1 deletions

View File

@ -718,7 +718,13 @@ node_status(Bridges) ->
aggregate_status(AllStatus) ->
Head = fun([A | _]) -> A end,
HeadVal = maps:get(status, Head(AllStatus), connecting),
AllRes = lists:all(fun(#{status := Val}) -> Val == HeadVal end, AllStatus),
AllRes = lists:all(
fun
(#{status := Val}) -> Val == HeadVal;
(_) -> false
end,
AllStatus
),
case AllRes of
true -> HeadVal;
false -> inconsistent