Skip to content

Commit ea30ca1

Browse files
committed
chore: Not crash when not found item
1 parent 074599e commit ea30ca1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/List.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,10 @@ class List<T = any> extends React.Component<ListProps<T>, ListState<T>> {
435435
}
436436

437437
const item = data[index];
438-
if (!item) {
438+
if (item === undefined) {
439439
/* istanbul ignore next */
440440
console.error('Not find index item. Please report this since it is a bug.');
441+
return null;
441442
}
442443

443444
return this.getItemKey(item, mergedProps);

0 commit comments

Comments
 (0)