I am looking for tips on how to perform better validation checking than what I did in this code snippet. What was happening, rarely, but it did happen was the value of DocumentStatus was null which is an invalid state but bad data happens. What is the cleanest and most efficient way to rewrite this and account for nulls? My entire form just crashed and locked up because of this. Is the only answer to add DocumentStatus != null to all the if statements? Does C# have an equivalent to the SQL coalesce function?
if (PmTransactionScroll.DocumentStatus == 3)
if (ViewPayablesDistributionZoomFormHIST == null || ViewPayablesDistributionZoomFormHIST.Created == false)
ViewPayablesDistributionZoomFormHIST = new frmViewJobLinkerHIST();