Skip to content

Commit 125c63a

Browse files
committed
Merge PR #17: Prevent SEGFAULT on EOF (^D) and minor patch improvement
2 parents 66386f1 + e0a1dd4 commit 125c63a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/VM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ void Thread::getLine()
241241
}
242242
line = el_gets(el, &linelen);
243243
linepos = 0;
244-
if (strncmp(line, "quit", 4)==0 || strncmp(line, "..", 2)==0) { line = NULL; throw errUserQuit; }
245-
if (line && linelen) {
244+
if (!line || strncmp(line, "quit", 4)==0 || strncmp(line, "..", 2)==0) { line = NULL; throw errUserQuit; }
245+
if (linelen > 0) {
246246
history(myhistory, &ev, H_ENTER, line);
247247
history(myhistory, &ev, H_SAVE, historyfilename);
248248
if (logfilename) {

0 commit comments

Comments
 (0)