diff --git a/src/Screen.cpp b/src/Screen.cpp index bd9569ffe..484950559 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -1341,12 +1341,8 @@ int Screen::copyLineToStream(int line , int screenLine = line - _history->getLines(); - // FIXME: This can be triggered when clearing history - // while having the searchbar open and selecting next/prev Q_ASSERT(screenLine <= _screenLinesSize); - screenLine = qMin(screenLine, _screenLinesSize); - Character* data = _screenLines[screenLine].data(); int length = _screenLines[screenLine].count(); diff --git a/src/SessionController.cpp b/src/SessionController.cpp index de5bc6ecf..b0bb53bfe 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -1318,7 +1318,7 @@ void SessionController::beginSearch(const QString& text, Enum::SearchDirection d QRegularExpression regExp = regexpFromSearchBarOptions(); _searchFilter->setRegExp(regExp); - if (_searchStartLine == -1) { + if (_searchStartLine < 0 || _searchStartLine > _view->screenWindow()->lineCount()) { if (direction == Enum::ForwardsSearch) { setSearchStartTo(_view->screenWindow()->currentLine()); } else {