From 2b53c065ce99d03c9efbaa46cf32a61a9865edca Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Tue, 2 Nov 2021 13:55:57 -0400 Subject: [PATCH] * BugFix: Correct an invalid memory access error caused by the tab autocomplete in the console when attempting to tab complete at the start of the input while there is text to the right. --- Engine/source/console/console.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index 750db2a17..14e75f0f8 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -485,6 +485,13 @@ U32 tabComplete(char* inputBuffer, U32 cursorPos, U32 maxResultLength, bool forw } completionBaseStart = p; completionBaseLen = cursorPos - p; + + // Bail if we end up at start of string + if (p == 0) + { + return cursorPos; + } + // Is this function being invoked on an object? if (inputBuffer[p - 1] == '.') {