fix segfault when completing ~ or .
ie. w/o any / in the given path we'll get an irregular split point and thus out of bounds array access
This commit is contained in:
parent
facb42fc35
commit
39b34a9109
1 changed files with 4 additions and 0 deletions
|
@ -462,6 +462,10 @@ void FbRun::tabCompleteApps() {
|
||||||
if (prefix.at(0) == '/' || prefix.at(0) == '.' || prefix.at(0) == '~') {
|
if (prefix.at(0) == '/' || prefix.at(0) == '.' || prefix.at(0) == '~') {
|
||||||
// we're completing a directory, find subdirs
|
// we're completing a directory, find subdirs
|
||||||
split = prefix.find_last_of('/');
|
split = prefix.find_last_of('/');
|
||||||
|
if (split == std::string::npos) {
|
||||||
|
split = prefix.size();
|
||||||
|
prefix.append("/");
|
||||||
|
}
|
||||||
prefix = prefix.substr(0, split+1);
|
prefix = prefix.substr(0, split+1);
|
||||||
if (prefix != m_last_completion_path) {
|
if (prefix != m_last_completion_path) {
|
||||||
m_files.clear();
|
m_files.clear();
|
||||||
|
|
Loading…
Reference in a new issue