diff --git a/src/client/spark/Modules/Trading/PNL/VM/PNLRowComparer.cs b/src/client/spark/Modules/Trading/PNL/VM/PNLRowComparer.cs index 0932b01db..9d88699da 100644 --- a/src/client/spark/Modules/Trading/PNL/VM/PNLRowComparer.cs +++ b/src/client/spark/Modules/Trading/PNL/VM/PNLRowComparer.cs @@ -90,12 +90,11 @@ namespace bts.shell.pnl { } int? _try_compare_groups(CollectionViewGroup x, CollectionViewGroup y) { - if (x == null || y == null) - return null; - var xcell = (IPNLCellData)x.Name; - var ycell = (IPNLCellData)y.Name; - var comp = _get_column_comparer(xcell.column); - return comp.value_comparer.Compare(xcell.value, ycell.value); + if (x?.Name is IPNLCellData xcell && y?.Name is IPNLCellData ycell) { + var comp = _get_column_comparer(xcell.column); + return comp.value_comparer.Compare(xcell.value, ycell.value); + } + return null; } } -} \ No newline at end of file +}