What i am trying to do here is to Test whether the GameTiles at a given index is empty. If its empty i will then Initialize a Tile and put it in GameTiles at the Tested index. But every time i try to check the GameTile the Game Engine will crash.
I am still very new to Unreal Engine 4. Any help would be greatly appreciated.
Exception was "Access violation - code c0000005 (first/second chance not available)"
Source context from "engine/source/runtime/coreuobject/private/uobject/uobjectbase.cpp"
It seems that the Game accessing GameTiles at the index is accessing random garbage.
Is there a way to check if the index at GameTiles is Garbage hence return a bool value telling the Game that you can create a new object for GameTiles at that index. I have tried using try catch but the game is still crashing.
Check last few lines in output log.
I guess, that object you are trying to check is some random garbage, since add Uninitialized does not really construct any objects, just fill array, to make indexes valid.
Build in debug and try to look what you really have in array.
I was wrong with the nullptr check. Cause you use GameTiles.AddUninitialized(GameTiles.Max()); on pointer type childs. I am wondering, why you use AddUninitialized?
Would not GameTiles.AddZeroed(GameTiles.Max()) or GameTiles.AddDefaulted(GameTiles.Max()) more suitable for you? There you can do the nullptr check. Well and I would use IsValid(object*) for the nullptr check.
Thanks alot for your help!!!
Yup you are right i should use either GameTiles.AddZeroed(GameTiles.Max()) or GameTiles.AddDefaulted(GameTiles.Max())
To do the nullptr check. Right now the checks is not crashing the game engine ( :