From 3fe5f97dcd7c8ef8deabc32a83f5075df13bc8d2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 12 Apr 2023 18:45:44 +0300 Subject: fix for another potential crash --- plugins/NewEventNotify/src/popup.cpp | 3 +-- src/core/stdfile/src/filerecvdlg.cpp | 3 ++- src/core/stdmsg/src/msglog.cpp | 2 +- src/mir_app/src/db_events.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 870d0b0835..cfb40947b7 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -190,8 +190,7 @@ static wchar_t* GetEventPreview(DB::EventInfo &dbei) // filenames comment2 = mir_wstrdup(blob.getName()); // description - if (*blob.getDescr()) - comment1 = mir_wstrdup(blob.getDescr()); + comment1 = mir_wstrdup(blob.getDescr()); } commentFix = POPUP_COMMENT_FILE; break; diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 099f419fcb..34d5251985 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -251,7 +251,8 @@ public: DB::FILE_BLOB blob(dbei); SetDlgItemText(m_hwnd, IDC_FILENAMES, blob.getName()); - SetDlgItemText(m_hwnd, IDC_MSG, blob.getDescr()); + if (mir_wstrlen(blob.getDescr())) + SetDlgItemText(m_hwnd, IDC_MSG, blob.getDescr()); wchar_t datetimestr[64]; TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0); diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 778ae5f991..318e246ae3 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -332,7 +332,7 @@ static bool CreateRTFFromDbEvent(LogStreamData *dat) buf.Append(": "); AppendToBufferWithRTF(buf, blob.getName()); - if (*blob.getDescr() != 0) { + if (mir_wstrlen(blob.getDescr())) { buf.Append(" ("); AppendToBufferWithRTF(buf, blob.getDescr()); buf.Append(")"); diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 6f6fc281be..263706d844 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -165,7 +165,7 @@ static INT_PTR DbEventGetTextWorker(DB::EventInfo *dbei, int codepage, int datat DB::FILE_BLOB blob(*dbei); CMStringW wszText(blob.getName()); - if (mir_wstrlen(blob.getDescr()) > 0) { + if (mir_wstrlen(blob.getDescr())) { wszText.Append(L": "); wszText.Append(blob.getDescr()); } -- cgit v1.2.3