Skip to content

Commit

Permalink
Fix crash during Search result
Browse files Browse the repository at this point in the history
Fix #11883, close #11889
  • Loading branch information
donho committed Jul 9, 2022
1 parent c7c5db7 commit e6fe568
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions PowerEditor/src/NppNotification.cpp
Expand Up @@ -963,6 +963,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
BufferID idd = _mainDocTab.getBufferByIndex(id);
Buffer * buf = MainFileManager.getBufferByID(idd);
if (buf == nullptr)
return FALSE;

tipTmp = buf->getFullPathName();

if (tipTmp.length() >= tipMaxLen)
Expand All @@ -975,6 +978,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
BufferID idd = _subDocTab.getBufferByIndex(id);
Buffer * buf = MainFileManager.getBufferByID(idd);
if (buf == nullptr)
return FALSE;

tipTmp = buf->getFullPathName();

if (tipTmp.length() >= tipMaxLen)
Expand Down
8 changes: 5 additions & 3 deletions lexilla/lexers/LexSearchResult.cxx
Expand Up @@ -77,8 +77,10 @@ static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lin

styler.ColourTo(startLine + currentPos - 1, SCE_SEARCHRESULT_LINE_NUMBER);

int currentStat = SCE_SEARCHRESULT_DEFAULT;
int currentState = SCE_SEARCHRESULT_DEFAULT;

if (linenum >= pMarkings->_length)
return;
SearchResultMarkingLine miLine = pMarkings->_markings[linenum];

for (std::pair<intptr_t, intptr_t> mi : miLine._segmentPostions)
Expand All @@ -92,11 +94,11 @@ static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lin
if (match_end <= endPos)
styler.ColourTo(match_end, SCE_SEARCHRESULT_WORD2SEARCH);
else
currentStat = SCE_SEARCHRESULT_WORD2SEARCH;
currentState = SCE_SEARCHRESULT_WORD2SEARCH;
}
}

styler.ColourTo(endPos, currentStat);
styler.ColourTo(endPos, currentState);
}
else // every character - search header
{
Expand Down

0 comments on commit e6fe568

Please sign in to comment.