Bläddra i källkod

Merge pull request #653 from Ragora/bugfix-asan-tabcomplete

BugFix: Correct an invalid memory access error caused by the tab autocomplete
Brian Roberts 4 år sedan
förälder
incheckning
7c1574355f
1 ändrade filer med 7 tillägg och 0 borttagningar
  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] == '.') 
       {