Skip to content

Commit cc9cee8

Browse files
authored
Do not crash when it has nothing to say. (#796)
Otherwise observing this in the interactive mode: /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_vector.h:1230: reference std::vector<int>::back() [_Tp = int, _Alloc = std::allocator<int>]: Assertion '!this->empty()' failed.
1 parent d2beca9 commit cc9cee8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/main/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ int main(int argc, char ** argv) {
431431
}
432432

433433
// end of text token
434-
if (embd.back() == llama_token_eos()) {
434+
if (!embd.empty() && embd.back() == llama_token_eos()) {
435435
if (params.instruct) {
436436
is_interacting = true;
437437
} else {

0 commit comments

Comments
 (0)