Fix the 'function_clause' error when session is undefined

This commit is contained in:
Feng Lee 2019-10-14 17:01:41 +08:00
parent a1877f3f42
commit 53dda48833
1 changed files with 2 additions and 0 deletions

View File

@ -153,6 +153,8 @@ attrs(session, #channel{session = Session}) ->
attrs(Key, Channel) -> info(Key, Channel).
-spec(stats(channel()) -> emqx_types:stats()).
stats(#channel{pub_stats = PubStats, session = undefined}) ->
maps:to_list(PubStats);
stats(#channel{pub_stats = PubStats, session = Session}) ->
maps:to_list(PubStats) ++ emqx_session:stats(Session).