UE4 Crashes if Guess is longer than HiddenWord.Len()

After adding the code from the “Out Parameters” lecture, UE4 crashes with an Out of Bounds error. This crash occurs whenever the user’s guess is longer than the HiddenWord.Len(). I cannot figure out why it is crashing as my code matches the instructors code during this video.

Here is the relevant crash log information:

[2021.03.17-20.27.34:406][678]LogWindows: Windows GetLastError: The operation completed successfully. (0)
[2021.03.17-20.27.35:902][678]LogWindows: Error: === Critical error: ===
[2021.03.17-20.27.35:902][678]LogWindows: Error: 
[2021.03.17-20.27.35:902][678]LogWindows: Error: Assertion failed: IsValidIndex(Index) [File:J:\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h] [Line: 329] 
[2021.03.17-20.27.35:902][678]LogWindows: Error: String index out of bounds: Index 6 from a string with a length of 6
[2021.03.17-20.27.35:902][678]LogWindows: Error: 
[2021.03.17-20.27.35:902][678]LogWindows: Error: 
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff9e980d759 KERNELBASE.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92c54d096 UE4Editor-Core.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92c5507f8 UE4Editor-Core.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92c25e98d UE4Editor-Core.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92c1f5625 UE4Editor-Core.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92c1f76d0 UE4Editor-Core.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff907f13625 UE4Editor-BullCowGame-5449.dll!DispatchCheckVerify<void,<lambda_9d71783244497e06153d098b42a507a8> >() [J:\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h:165]
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff907efd6cf UE4Editor-BullCowGame-5449.dll!UBullCowCartridge::GetBullCows() [D:\Dev\Repos\C++\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp:127]
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff907efdbe3 UE4Editor-BullCowGame-5449.dll!UBullCowCartridge::ProcessGuess() [D:\Dev\Repos\C++\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp:85]
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff907efb199 UE4Editor-BullCowGame-5449.dll!UTerminal::AcceptInputLine() [D:\Dev\Repos\C++\BullCowGame-starter-kit\Source\BullCowGame\Console\Terminal.cpp:143]
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff907efc238 UE4Editor-BullCowGame-5449.dll!UTerminal::OnKeyDown() [D:\Dev\Repos\C++\BullCowGame-starter-kit\Source\BullCowGame\Console\Terminal.cpp:112]
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff907efb9e0 UE4Editor-BullCowGame-5449.dll!TBaseUObjectMethodDelegateInstance<0,UTerminal,void __cdecl(FKey),FDefaultDelegateUserPolicy>::Execute() [J:\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:593]
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92a3eb02c UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92a41a8ee UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff929ec577c UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff929ed8fd2 UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff929ec36eb UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff929ed6ea1 UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff9290ef46e UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92a2cb44e UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92a2d40f0 UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92c00ed11 UE4Editor-Core.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92c00f0fe UE4Editor-Core.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92c02092d UE4Editor-Core.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92a2f0ffe UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff92a2f793a UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff929a1886f UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff929a23109 UE4Editor-Engine.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff9279494d6 UE4Editor-UnrealEd.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff928264206 UE4Editor-UnrealEd.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff761e39bda UE4Editor.exe!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff761e511ac UE4Editor.exe!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff761e5128a UE4Editor.exe!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff761e652ed UE4Editor.exe!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff761e6801a UE4Editor.exe!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff9e9bb7034 KERNEL32.DLL!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: [Callstack] 0x00007ff9ebb02651 ntdll.dll!UnknownFunction []
[2021.03.17-20.27.35:902][678]LogWindows: Error: 
[2021.03.17-20.27.35:907][678]LogExit: Executing StaticShutdownAfterError
[2021.03.17-20.27.35:909][678]LogWindows: FPlatformMisc::RequestExit(1)
[2021.03.17-20.27.35:909][678]LogCore: Engine exit requested (reason: Win RequestExit)
[2021.03.17-20.27.36:071][678]Log file closed, 03/17/21 16:27:36

Here is a screenshot of my code:

You’re missing a return within the block that checks for the length to be the same.

This would mean you are calling the code that assumes they are the same length, and then going out of bounds of one of the strings when they are in fact not the same length.

Thank you for looking into the issue!

I thought that looked weird too but I did not see it in the instructors video, so I didn’t add it. However, after adding a return to my GetBullCows() function I’ve had mixed results. Sometimes it works and sometimes it doesn’t. At one point I tried adding multiple returns with the same mixed results.

Are you sure?

Wow, I completely misunderstood your original message and put the return in the wrong place. I can’t believe I missed that originally. That seemed to do the trick. I really appreciate your help!

Probably didn’t help that I incorrectly said “checks for the length to be the same” instead of “not be the same” …

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms