mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Do not fail on incorrect data coming from SQL (898)
This commit is contained in:
parent
c7931b4a4f
commit
65e6dfb9dd
@ -756,8 +756,9 @@ select(LServer, #jid{luser = LUser} = JidRequestor,
|
||||
true ->
|
||||
{Res, true}
|
||||
end,
|
||||
{lists:map(
|
||||
{lists:flatmap(
|
||||
fun([TS, XML, PeerBin, Kind, Nick]) ->
|
||||
try
|
||||
#xmlel{} = El = xml_stream:parse_element(XML),
|
||||
Now = usec_to_now(jlib:binary_to_integer(TS)),
|
||||
PeerJid = jid:tolower(jid:from_string(PeerBin)),
|
||||
@ -766,14 +767,22 @@ select(LServer, #jid{luser = LUser} = JidRequestor,
|
||||
null -> chat;
|
||||
_ -> jlib:binary_to_atom(Kind)
|
||||
end,
|
||||
{TS, jlib:binary_to_integer(TS),
|
||||
[{TS, jlib:binary_to_integer(TS),
|
||||
msg_to_el(#archive_msg{timestamp = Now,
|
||||
packet = El,
|
||||
type = T,
|
||||
nick = Nick,
|
||||
peer = PeerJid},
|
||||
MsgType,
|
||||
JidRequestor)}
|
||||
JidRequestor)}]
|
||||
catch _:Err ->
|
||||
?ERROR_MSG("failed to parse data from SQL: ~p. "
|
||||
"The data was: "
|
||||
"timestamp = ~s, xml = ~s, "
|
||||
"peer = ~s, kind = ~s, nick = ~s",
|
||||
[Err, TS, XML, PeerBin, Kind, Nick]),
|
||||
[]
|
||||
end
|
||||
end, Res1), IsComplete, jlib:binary_to_integer(Count)};
|
||||
_ ->
|
||||
{[], false, 0}
|
||||
|
Loading…
Reference in New Issue
Block a user