- Fixed: The scanner triggered an assertion failure on empty strings.

SVN r3321 (trunk)
This commit is contained in:
Braden Obrzut 2011-11-26 06:59:35 +00:00
parent cffae9c33c
commit 7d348e7148

View file

@ -239,7 +239,7 @@ void FScanner::PrepareScript ()
{ {
// If the last character in the buffer is a null character, change // If the last character in the buffer is a null character, change
// it to a newline. Otherwise, append a newline to the end. // it to a newline. Otherwise, append a newline to the end.
if (ScriptBuffer[ScriptBuffer.Len() - 1] == '\0') if (ScriptBuffer.Len() > 0 && ScriptBuffer[ScriptBuffer.Len() - 1] == '\0')
{ {
ScriptBuffer.LockBuffer()[ScriptBuffer.Len() - 1] = '\n'; ScriptBuffer.LockBuffer()[ScriptBuffer.Len() - 1] = '\n';
ScriptBuffer.UnlockBuffer(); ScriptBuffer.UnlockBuffer();