Skip to content

Commit 73a4d6f

Browse files
committed
Fix null cases (#5419)
1 parent 8f4b7d2 commit 73a4d6f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

news/2 Fixes/5414.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix sorting of lists.
1+
Fix sorting of lists with numbers and missing entries.

src/datascience-ui/data-explorer/mainPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
366366
// or it will take too long
367367
const comparer = isStringColumn ?
368368
(a: any, b: any): number => {
369-
const aVal = a[sortColumn].toString();
370-
const bVal = b[sortColumn].toString();
369+
const aVal = a[sortColumn] ? a[sortColumn].toString() : '';
370+
const bVal = b[sortColumn] ? b[sortColumn].toString() : '';
371371
const aStr = aVal ? aVal.substring(0, Math.min(aVal.length, MaxStringCompare)) : aVal;
372372
const bStr = bVal ? bVal.substring(0, Math.min(bVal.length, MaxStringCompare)) : bVal;
373373
const result = aStr > bStr ? -1 : 1;

0 commit comments

Comments
 (0)