diff --git a/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp b/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp index ec0735cb..e889115d 100644 --- a/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp @@ -108,6 +108,7 @@ INT_PTR CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) updateLinesNumbers(); return TRUE; } + default : { switch (HIWORD(wParam)) @@ -142,7 +143,8 @@ void GoToLineDlg::updateLinesNumbers() const else { current = static_cast((*_ppEditView)->execute(SCI_GETCURRENTPOS)); - limit = static_cast((*_ppEditView)->getCurrentDocLen() - 1); + int currentDocLength = (*_ppEditView)->getCurrentDocLen(); + limit = static_cast(currentDocLength > 0 ? currentDocLength - 1 : 0); } ::SetDlgItemInt(_hSelf, ID_CURRLINE, current, FALSE); ::SetDlgItemInt(_hSelf, ID_LASTLINE, limit, FALSE);