diff options
author | George Hazan <ghazan@miranda.im> | 2017-10-01 00:16:30 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-10-01 00:16:30 +0300 |
commit | 78854c09f5a444d8db078333826e7a84e14e6f2c (patch) | |
tree | d73008a82d65bfb3ee1ad8b26ab6e31187c7fe1a /plugins/TabSRMM | |
parent | e41a97b593e89647ed215ebe3c51b01db71bb146 (diff) |
fix for the eternal loop
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 7c085e3bbe..938d926472 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1125,35 +1125,37 @@ void CTabBaseDlg::ReplaceIcons(LONG startAt, int fAppend, BOOL isSent) CComPtr<IRichEditOle> ole;
m_log.SendMsg(EM_GETOLEINTERFACE, 0, (LPARAM)&ole);
- while (m_log.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) {
- CHARRANGE cr;
- cr.cpMin = fi.chrgText.cpMin;
- cr.cpMax = fi.chrgText.cpMax + 2;
- m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&cr);
+ if (ole != nullptr) {
+ while (m_log.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) {
+ CHARRANGE cr;
+ cr.cpMin = fi.chrgText.cpMin;
+ cr.cpMax = fi.chrgText.cpMax + 2;
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&cr);
- tr.chrg.cpMin = fi.chrgText.cpMin + 3;
- tr.chrg.cpMax = fi.chrgText.cpMin + 5;
- m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr);
-
- int bIconIndex = trbuffer[0] - '0';
- if (bIconIndex >= NR_LOGICONS) {
- fi.chrg.cpMin = fi.chrgText.cpMax + 6;
- continue;
+ tr.chrg.cpMin = fi.chrgText.cpMin + 3;
+ tr.chrg.cpMax = fi.chrgText.cpMin + 5;
+ m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr);
+
+ int bIconIndex = trbuffer[0] - '0';
+ if (bIconIndex >= NR_LOGICONS) {
+ fi.chrg.cpMin = fi.chrgText.cpMax + 6;
+ continue;
+ }
+
+ char bDirection = trbuffer[1];
+ m_log.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
+ COLORREF crDefault;
+ if (cf2.crBackColor != 0)
+ crDefault = cf2.crBackColor;
+ else if (bDirection == '>')
+ crDefault = (fAppend) ? m_pContainer->theme.outbg : m_pContainer->theme.oldoutbg;
+ else
+ crDefault = (fAppend) ? m_pContainer->theme.inbg : m_pContainer->theme.oldinbg;
+
+ TLogIcon theIcon(Logicons[bIconIndex], crDefault);
+ CImageDataObject::InsertBitmap(ole, theIcon.m_hBmp);
+ fi.chrg.cpMin = cr.cpMax + 6;
}
-
- char bDirection = trbuffer[1];
- m_log.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
- COLORREF crDefault;
- if (cf2.crBackColor != 0)
- crDefault = cf2.crBackColor;
- else if (bDirection == '>')
- crDefault = (fAppend) ? m_pContainer->theme.outbg : m_pContainer->theme.oldoutbg;
- else
- crDefault = (fAppend) ? m_pContainer->theme.inbg : m_pContainer->theme.oldinbg;
-
- TLogIcon theIcon(Logicons[bIconIndex], crDefault);
- CImageDataObject::InsertBitmap(ole, theIcon.m_hBmp);
- fi.chrg.cpMin = cr.cpMax + 6;
}
}
|