]> granicus.if.org Git - ejabberd/commitdiff
Guard against pres_last=undefined in mod_offline
authorPaweł Chmielowski <pchmielowski@process-one.net>
Wed, 20 Jun 2018 10:16:01 +0000 (12:16 +0200)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Wed, 20 Jun 2018 10:16:10 +0000 (12:16 +0200)
src/mod_offline.erl

index 695cc6a949bcf261547ff38c179b4abfd92ad274..9e8af2c16e9a6b5758ba72ffda6ec3a87d29cfa0 100644 (file)
@@ -482,8 +482,8 @@ c2s_self_presence({_Pres, #{resend_offline := false}} = Acc) ->
     Acc;
 c2s_self_presence({#presence{type = available} = NewPres, State} = Acc) ->
     NewPrio = get_priority_from_presence(NewPres),
-    LastPrio = case maps:get(pres_last, State, error) of
-                  error -> -1;
+    LastPrio = case maps:get(pres_last, State, undefined) of
+                  undefined -> -1;
                   LastPres -> get_priority_from_presence(LastPres)
               end,
     if LastPrio < 0 andalso NewPrio >= 0 ->