From 62fd955a0ec4e384a63841aa0e4728caebf5b216 Mon Sep 17 00:00:00 2001 From: firest Date: Wed, 14 Sep 2022 14:16:43 +0800 Subject: [PATCH] fix(authn_redis): make dialyzer happy --- apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl index c6d2846ab..735cfe226 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl @@ -141,8 +141,8 @@ authenticate( {ok, []} -> ignore; {ok, Values} -> - case lists:all(fun(E) -> E =:= undefined end, Values) of - true -> + case check_query_matched(Values) of + false -> %% key not exists ignore; _ -> @@ -228,3 +228,10 @@ merge(Fields, Values) -> || {K, V} <- lists:zip(Fields, Values), V =/= undefined ] ). + +check_query_matched(undefined) -> + false; +check_query_matched(List) when is_list(List) -> + lists:any(fun(E) -> E =/= undefined end, List); +check_query_matched(_) -> + true.