Skip to content

Commit da045bc

Browse files
committed
Out of range error in prompt example for ENTER input
terminate called after throwing an instance of 'std::out_of_range' 1,1 ] what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 1) gdb: 0x00005555555575da in determine_completeness (command="\n") at /home/awvwgk/projects/src/git/cpp-terminal/examples/prompt.cpp:15
1 parent 3ef3ff4 commit da045bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/prompt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using Term::Terminal;
1212
bool determine_completeness([[maybe_unused]] std::string command) {
1313
// Determine if the statement is complete
1414
bool complete;
15-
if (command.substr(command.size() - 2, 1) == "\\") {
15+
if (command.size() > 1 && command.substr(command.size() - 2, 1) == "\\") {
1616
complete = false;
1717
} else {
1818
complete = true;

0 commit comments

Comments
 (0)