Why is assigning a TMap crashing unreal?

I’m trying to store the current day of the week as an int to save space, and only translate it into a string for display purposes:

TMap<int32, FString> dayMap;
dayMap[1] = "Monday";
dayMap[2] = "Tuesday";
dayMap[3] = "Wednesday";
dayMap[4] = "Thursday";
dayMap[5] = "Friday";
dayMap[6] = "Saturday";
dayMap[7] = "Sunday";

This compiles, but whenever I try to run it, the first time I try to assign a value to a key of dayMap the entire thing crashes- is this the incorrect syntax to use tmaps?

Could you try add


Maybe there must be some inicialization.

Hmm, that crashes as well, on the same “dayMap[1] = “Monday”;” line. If it helps, the start of the crashlog is weird- the file path is cut off, so the entire line reads

“Assertion failed: Pair != nullptr [File:C:\Progr”

Oh, I’m a moron-I was using the wrong syntax, I should’ve been using TMap.Add(tkey, tvalue);

Well your learn me something new. I though that assignment is also allowed.

You’re not a moron as that’s how entries have been added to every map/dictionary/associative array in every language since like, forever.