fix (pre-emptive): Add null check in SecurityFormatter

This commit is contained in:
John Colvin committed 2022-06-02 17:44:38 -04:00
1 parent eaa9376577
commit 634d8e1aeb
1 file changed
+4 -2
@@ -180,7 +180,8 @@
}
static string _get_first_leg_name(ContractLegImmutable leg) {
string sec_str = _format(leg.Security, false);
string sec_str = leg.HasSecurity ?
_format(leg.Security, false) : "NoSecurity";
return leg.signed_quantity() switch {
1.0 => sec_str,
-1.0 => $"-{sec_str}",
@@ -189,7 +190,8 @@
}
static string _get_subsequent_leg_name(ContractLegImmutable leg) {
string sec_str = _format(leg.Security, false);
string sec_str = leg.HasSecurity ?
_format(leg.Security, false) : "NoSecurity";
return leg.signed_quantity() switch {
1.0 => $"+{sec_str}",
-1.0 => $"-{sec_str}",