Description

The editor crashes when the Count parameter passed into the Mid function is < 0.

There is an assertion

check(Count >= 0);

in FString Mid in UnrealString.h, but an error message would be expected rather than an editor crash.

Steps to Reproduce
  1. Open the editor
  2. Create a new actor blueprint
  3. On Begin Play, add a Print String Node
  4. Add a Mid node and set the Start to 0, and the Count to -1
  5. Connect the return to the String pin of the Print String node
  6. Compile the blueprint
  7. Place an instance of the actor in the level
  8. PIE

Result: Editor crashes

Expected: Error message would appear in the output log or blueprint compile would fail due to the invalid value.

Callstack
>	UE4Editor-Core.dll!FString::Mid(int Start, int Count) Line 1153	C++
 	UE4Editor-CodeStuff.dll!AThrowCharacter::BeginPlay() Line 20	C++
 	UE4Editor-Engine.dll!AWorldSettings::NotifyBeginPlay() Line 175	C++
 	UE4Editor-Engine.dll!AGameStateBase::HandleBeginPlay() Line 177	C++
 	UE4Editor-Engine.dll!UWorld::BeginPlay() Line 3358	C++
 	UE4Editor-Engine.dll!UGameInstance::StartPIEGameInstance(ULocalPlayer * LocalPlayer, bool bInSimulateInEditor, bool bAnyBlueprintErrors, bool bStartInSpectatorMode) Line 282	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::CreatePIEGameInstance(int InPIEInstance, bool bInSimulateInEditor, bool bAnyBlueprintErrors, bool bStartInSpectatorMode, bool bRunAsDedicated, float PIEStartTime) Line 3358	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::PlayInEditor(UWorld * InWorld, bool bInSimulateInEditor) Line 2462	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::StartQueuedPlayMapRequest() Line 1160	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1320	C++
 	UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 371	C++
 	UE4Editor.exe!FEngineLoop::Tick() Line 2859	C++
 	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 152	C++
 	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191	C++
 	UE4Editor.exe!__scrt_common_main_seh() Line 253	C++

Have Comments or More Details?

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

2
Login to Vote

Fixed
ComponentUE - Gameplay
Affects Versions4.134.14
Target Fix4.17
Fix Commit3195953
CreatedDec 29, 2016
ResolvedJun 15, 2017
UpdatedSep 14, 2021