Consistently check for undefined rather than nullish
This commit is contained in:
@@ -313,19 +313,19 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
|
|||||||
|
|
||||||
// Check if the selected node actually exists (bounds check) and get its location if relevant
|
// Check if the selected node actually exists (bounds check) and get its location if relevant
|
||||||
let jumpLocation: Sarif.Location | undefined;
|
let jumpLocation: Sarif.Location | undefined;
|
||||||
if (key.pathNodeIndex != null) {
|
if (key.pathNodeIndex !== undefined) {
|
||||||
jumpLocation = Keys.getPathNode(data, key);
|
jumpLocation = Keys.getPathNode(data, key);
|
||||||
if (jumpLocation == null) {
|
if (jumpLocation === undefined) {
|
||||||
return prevState; // Result does not exist
|
return prevState; // Result does not exist
|
||||||
}
|
}
|
||||||
} else if (key.pathIndex != null) {
|
} else if (key.pathIndex !== undefined) {
|
||||||
if (Keys.getPath(data, key) == null) {
|
if (Keys.getPath(data, key) === undefined) {
|
||||||
return prevState; // Path does not exist
|
return prevState; // Path does not exist
|
||||||
}
|
}
|
||||||
jumpLocation = undefined; // When selecting a 'path', don't jump anywhere.
|
jumpLocation = undefined; // When selecting a 'path', don't jump anywhere.
|
||||||
} else {
|
} else {
|
||||||
jumpLocation = Keys.getResult(data, key)?.locations?.[0];
|
jumpLocation = Keys.getResult(data, key)?.locations?.[0];
|
||||||
if (jumpLocation == null) {
|
if (jumpLocation === undefined) {
|
||||||
return prevState; // Path step does not exist.
|
return prevState; // Path step does not exist.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user