Skip to content

Commit

Permalink
fix: fetchSubkey not properly checking undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
TheChristophe authored Feb 16, 2024
1 parent 076bf4d commit 6d901bb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions components/result-search/jsonKeyHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export const fetchSubkey = (obj: Json, keyPath: string): unknown => {
const keys = keyPath.split('.');
let sub_item: Json = obj;
for (const sub_key of keys) {
if (sub_item === 'undefined' || sub_item === null) {
return undefined;
}
if (typeof sub_item !== 'object') {
if (sub_item == null || typeof sub_item !== 'object') {
return undefined;
}
sub_item = (sub_item as Record<string, Json>)[sub_key];
Expand Down

0 comments on commit 6d901bb

Please sign in to comment.