瀏覽代碼

* 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.

Robert MacGregor 3 年之前
父節點
當前提交
2b53c065ce
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      Engine/source/console/console.cpp

+ 7 - 0
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] == '.') 
       {