commit 59565e1cb3cef4e9e73d9328b1b0c93e94ddace7
parent 15c59eead3aa33edca4ee676a4ac18499f8f2b84
Author: Michael Savage <mikejsavage@gmail.com>
Date: Fri, 7 Sep 2018 17:05:20 +0300
Fix input segfault
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/input.cc b/src/input.cc
@@ -45,7 +45,7 @@ void input_return() {
if( inputLen > 0 ) {
InputHistory * lastCmd = &inputHistory[ ( inputHistoryHead + inputHistoryCount - 1 ) % MAX_INPUT_HISTORY ];
- if( inputLen != lastCmd->len || strncmp( inputBuffer, lastCmd->text, inputLen ) != 0 ) {
+ if( inputHistoryCount == 0 || inputLen != lastCmd->len || strncmp( inputBuffer, lastCmd->text, inputLen ) != 0 ) {
int pos = ( inputHistoryHead + inputHistoryCount ) % MAX_INPUT_HISTORY;
if( inputHistoryCount == MAX_INPUT_HISTORY ) {