Hi, I want to know why this simple for loop is infinite?
Tested the code with Engine version 4.20 and 4.26, both execute it as infinite loop.
for (int32 i = 1; i <= 10; i++)
{
print100s("Loop Executed!");
}
Full code of the function where that loop is called
void AMyGameMode::RandomItemID(EItemType ItemType, FST_ItemTypeAndID &Item)
{
FST_ItemTypeAndID TempItemTypeAndID_var{};
ItemType = TempItemTypeAndID_var.Type = EItemType::E_Weapon;
switch (ItemType)
{
case EItemType::E_Weapon:
{
if (const UDataTable *DT_ItamWeaponRows = LoadObject<UDataTable> (GetWorld(), TEXT("/Game/DataTables/DT_ItamWeapon")))
{
OutRowNamesWeapons = DT_ItamWeaponRows->GetRowNames();
for (auto &WeaponArrayElem: OutRowNamesWeapons)
{
if (const UDataTable *DT_ItamWeapon
{
LoadObject<UDataTable> (GetWorld(), TEXT("/Game/DataTables/DT_ItamWeapon")) })
{
if (const FST_ItemWeapon *OutRow
{
DT_ItamWeapon->FindRow<FST_ItemWeapon> (FName(WeaponArrayElem), "") })
{
if (OutRow)
{
for (int32 i = 1; i <= 10; i++)
{
print100s("Loop Executed!");
}
}
}
}
}
}
}
break;
default:
{
print100s("Default State-");
}
break;
}
}
commenting all if statements and running the program gives correct results.