I'm trying to update an object with another object asynchronously. I'm trying to get the CustomerId value from Statues and then use it to call a specific customer and pass those values into PreviousStatuses. Then update the StatusToAdd with PreviousStatuses. If I pass Statues to StatusToAdd the values update. However, it's the wrong customer id. That's why I'm using PreviousStatuses.
This is the error I get:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at DSPDRewrite.Pages.Popups.AddStatusComponent.UpdateValues(String id)
   at DSPDRewrite.Pages.Popups.AddStatusComponent.OnInitializedAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
 [Parameter]
    public int CustomerId { get; set; }
[CascadingParameter]
public Task<AuthenticationState> AuthState { get; set; }
public Status Statuses;
public Status PreviousStatuses;
//IList<Status> PreviousStatuses;
public Dspd1056Status StatusToAdd = new Dspd1056Status();
public Customer customer;
public int AccountStatusId = 0;
protected override async Task OnInitializedAsync()
{
    Statuses = await dataService.Get1056StatusById(CustomerId);
    //int id = Int32.Parse(Statuses.CustomerId);
    //  Statuses = await dataService.Get1056StatusById(id);
    Console.WriteLine(Statuses.CustomerId);
    await UpdateValues(Statuses.CustomerId);
}
async Task UpdateValues(string id)
{
    PreviousStatuses = await dataService.Get1056StatusById(Int32.Parse((id)));
    StatusToAdd.AccountCurrent = PreviousStatuses.AccountCurrent;
    StatusToAdd.StartDate = PreviousStatuses.StartDate;
    StatusToAdd.EndDate = PreviousStatuses.EndDate;
    StatusToAdd.Units = PreviousStatuses.Units;
    StatusToAdd.Ppc = PreviousStatuses.Ppc;
    StatusToAdd.EndStatus = PreviousStatuses.EndStatus;
    StatusToAdd.ContinuallyFunded = PreviousStatuses.ContinuallyFunded;
    StatusToAdd.AnnualUnits = PreviousStatuses.AnnualUnits;
    StatusToAdd.Elg = PreviousStatuses.Elg;
    StatusToAdd.ReceiptDate = PreviousStatuses.ReceiptDate;
    StatusToAdd.RahTripsFunded = PreviousStatuses.RahTripsFunded;
    StatusToAdd.Rate = PreviousStatuses.Rate;
    StatusToAdd.AccountTotal = PreviousStatuses.AccountTotal;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
    if (firstRender)
    {
        if (CustomerId != 0)
        {
            customer = await dataService.GetCustomerById((int)CustomerId);
            StateHasChanged();
        }
    }
}
 
    