Need help, getting an idex out of bounds error

Ok so here is what I’m trying to do in my code:
1
But every time I try to run the IsIsogram() function inside the "TempWordList loop" I get this error:


The loop seems to run perfectly fine on its own or doing other things like printing out lines or doing other if statements but as soon as the IsIsogram() function is in it in any way, even not using data from the array as input but a hardcoded word, it just crashes. I’ve tried using the TEXT("") on the input as well but the result is the same. I’ve added the WordLists folder in the project settings properly, besides I was able to get it to print the entire contents of the TempWordList array so I don’t think the issue is in acessing the words.
Here is what my IsIsogram() looks like:
2

What am I missing here, this behaviour seems rather strange but I’m probably making some dumb mistake.

  1. You shouldn’t be using * for that. The function takes an FString and the Array has FString's so you don’t need to convert it to const TCHAR*.
    At the moment you are doing the following conversions FString to const TCHAR* and back to FString
  2. Your IsIsogram function is using HiddenWord instead of Guess

Thank you. You’e totally right it doesn’t make logical sense to de-reference the TempWordList[Index], in my defence I do still find referncing a bit confusing, it was pretty late and I was basically trying anything at that point, I probably didn’t put it in like that at first and forgot to take it out.

That IsIsogram() function though, I feel real dumb about that one. No wonder it was giving an out of bouds error for index 0, the HiddenWord was not even initialised at that point. Not that is was supposed to be hardcoded there in the first place. I even looked at the function multiple times to see if there is nothing wrong with it and did not spot it…

Well now my stupidity will forever be engraved here, it will serve as a good lesson for me.

Thanks again for your help.

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

Privacy & Terms