Description

If you use a 5 character string (hello) to call the Mid function and provide 0 for start, -1 for count, it'll give you the entire string. This should either return an assert or treat all negatives at a 0 to return nothing.

Steps to Reproduce

1. Create a new blank C++ project
2. Add a new C++ class based off Actor
3. In the .h file, on line 22, add the following lines:

 FString a = "hello";
	FString b = a.Mid(0, -1);

4. In the .cpp file, at line 20, add the following line:

 GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, b); 

5. In the same .cpp file, on line 5, add the following line:

 #include "Engine.h" 

6. Return to the editor and hit the Compile button
7. After the compilation is done, create a new blueprint of your new Actor class
8. Create an instance of this new blueprint by dragging it into the level
9. Press PIE
Result: "hello" is printed on the screen
Expected: The -1 for the count variable should result in this either displaying nothing or throwing an assert to let the user know that it should not be given a negative number.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Fixed
ComponentUE - Foundation - Core
Affects Versions4.8.14.8.24.94.14
Target Fix4.14
Fix Commit3090495
Main Commit3126145
CreatedJul 16, 2015
ResolvedAug 16, 2016
UpdatedFeb 5, 2017
View Jira Issue