Page MenuHomeFeedback Tracker

Passing in NULL for an argument in a function called recursively nulls the argument in the caller
Assigned, NormalPublic

Description

ref TStringArray garr = {"A", "B", "C"};

void TestArr(TStringArray arr, bool recursive = true)
{
    Print("[1] " + (arr != null));
    if (recursive)
        TestArr(null, false);
    Print("[2] " + (arr != null));
}

> TesTarr(garr)
[1] true  // Non-null argument passed in
[1] false  // Expected, recursive call with null argument
[2] false  // Expected, recursive call with null argument
[2] false  // back in caller, passed in arg now null despite it shouldn't be

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Modding

Event Timeline

lava76 created this task.Jun 21 2023, 5:15 PM
Geez changed the task status from New to Assigned.Jun 28 2023, 11:57 AM