diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index 301c356ef..f8b07bf46 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -443,7 +443,7 @@ void Gripper::doTabReordering(POINT pt) auto iSel = ::SendMessage(_hTab, TCM_GETCURSEL, 0, 0); ::SendMessage(_hTab, TCM_DELETEITEM, iSel, 0); } - else if (_hTab == hTabOld) + else if (_hTab && _hTab == hTabOld) { // delete item on switch between tabs ::SendMessage(_hTab, TCM_DELETEITEM, iItemOld, 0); diff --git a/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp b/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp index 1c4f8fd47..fa32f488e 100644 --- a/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp +++ b/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp @@ -127,10 +127,10 @@ intptr_t CALLBACK FindCharsInRangeDlg::run_dlgProc(UINT message, WPARAM wParam, bool FindCharsInRangeDlg::findCharInRange(unsigned char beginRange, unsigned char endRange, intptr_t startPos, bool direction, bool wrap) { - size_t totalSize = (*_ppEditView)->getCurrentDocLen(); + int64_t totalSize = (*_ppEditView)->getCurrentDocLen(); if (startPos == -1) startPos = direction == dirDown ? 0 : totalSize - 1; - if (static_cast(startPos) > totalSize) + if (startPos > totalSize) return false; char *content = new char[totalSize + 1]; @@ -139,8 +139,8 @@ bool FindCharsInRangeDlg::findCharInRange(unsigned char beginRange, unsigned cha bool isFound = false; size_t found = 0; - for (intptr_t i = startPos - (direction == dirUp ? 1 : 0); - (direction == dirDown) ? i < static_cast(totalSize) : i >= 0 ; + for (int64_t i = startPos - (direction == dirDown ? 0 : 1); + (direction == dirDown) ? i < totalSize : i >= 0 ; (direction == dirDown) ? (++i) : (--i)) { if (static_cast(content[i]) >= beginRange && static_cast(content[i]) <= endRange) @@ -155,7 +155,7 @@ bool FindCharsInRangeDlg::findCharInRange(unsigned char beginRange, unsigned cha { if (wrap) { - for (size_t i = (direction == dirUp ? totalSize - 1 : 0); + for (int64_t i = (direction == dirDown ? 0: totalSize - 1); (direction == dirDown) ? i < totalSize : i >= 0 ; (direction == dirDown) ? (++i) : (--i)) { diff --git a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChanges.cpp b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChanges.cpp index bbbf053c7..c2433f2f8 100644 --- a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChanges.cpp +++ b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChanges.cpp @@ -82,6 +82,9 @@ void CReadDirectoryChanges::AddDirectory( LPCTSTR szDirectory, BOOL bWatchSubtre if (!m_hThread) Init(); + if (!m_hThread) + return; + CReadChangesRequest* pRequest = new CReadChangesRequest(m_pServer, szDirectory, bWatchSubtree, dwNotifyFilter, dwBufferSize); QueueUserAPC(CReadChangesServer::AddDirectoryProc, m_hThread, (ULONG_PTR)pRequest); } diff --git a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp index 636e3d340..74111cb22 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp @@ -943,7 +943,10 @@ void WindowsDlg::doCount() void WindowsDlg::doSort() { - size_t count = (_pTab != NULL) ? _pTab->nbItem() : 0; + if (_pTab == NULL) + return; + + size_t count = _pTab->nbItem(); std::vector items(count); auto currrentTabIndex = _pTab->getCurrentTabIndex(); NMWINDLG nmdlg = {}; diff --git a/PowerEditor/visual.net/notepadPlus.ruleset b/PowerEditor/visual.net/notepadPlus.ruleset index 2fde9ee3c..10cb35afa 100644 --- a/PowerEditor/visual.net/notepadPlus.ruleset +++ b/PowerEditor/visual.net/notepadPlus.ruleset @@ -38,7 +38,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -205,7 +205,7 @@ - + @@ -255,7 +255,7 @@ - +