From 194acc9d86eb5ffd14426210b9af4b1ed645c29f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Jun 2024 18:30:09 +0300 Subject: MsgExport: fix for rare crash --- plugins/Msg_Export/src/export.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/Msg_Export/src/export.cpp b/plugins/Msg_Export/src/export.cpp index ca2b9e108a..6615db1315 100644 --- a/plugins/Msg_Export/src/export.cpp +++ b/plugins/Msg_Export/src/export.cpp @@ -300,8 +300,10 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF if (auto *si = Chat_Find(hContact, szProto)) { if (auto *pUser = g_chatApi.UM_FindUser(si, Utf2T(dbei.szUserId))) sRemoteUser = pUser->pszNick; - else - sRemoteUser = Utf2T(dbei.szUserId); + else { + Utf2T tmp(dbei.szUserId); + sRemoteUser = (tmp) ? tmp.get() : _A2T(dbei.szUserId); + } } // Get time stamp @@ -416,9 +418,7 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF break; } } - else { - output.AppendFormat(TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob); - } + else output.AppendFormat(TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob); output.Append(g_plugin.bAppendNewLine ? L"\r\n\r\n" : L"\r\n"); if (!bWriteTextToFile(hFile, output, bWriteUTF8Format, output.GetLength())) -- cgit v1.2.3