diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 626b64f1..9b50f923 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -5925,10 +5925,13 @@ std::vector Notepad_plus::loadCommandlineParams(const TCHAR * co if (cpos != -1) { - // make sure not jumping into the middle of a multibyte character - // or into the middle of a CR/LF pair for Windows files - auto before = _pEditView->execute(SCI_POSITIONBEFORE, cpos); - cpos = static_cast(_pEditView->execute(SCI_POSITIONAFTER, before)); + if (cpos > 0) + { + // make sure not jumping into the middle of a multibyte character + // or into the middle of a CR/LF pair for Windows files + auto before = _pEditView->execute(SCI_POSITIONBEFORE, cpos); + cpos = static_cast(_pEditView->execute(SCI_POSITIONAFTER, before)); + } _pEditView->execute(SCI_GOTOPOS, cpos); } else if (cn == -1)