The following line of code:
double? paidAmount = invoices.Value.Where(x => x.Status.Equals(Constants.InvoicePaid)).Sum(x => x.TotalAmount);
Is causing an error when the status is null.:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Can I avoid this exception using null-coalescing? If interested, here I'm checking if the status property is equal to "paid"
I want to sum.