Skip to content

Commit

Permalink
fix(TimePicker): guard against null pointer (#14506)
Browse files Browse the repository at this point in the history
* fix(TimePicker): guard against null pointer

* chore(storybook): remove test story
  • Loading branch information
tw15egan committed Aug 25, 2023
1 parent 639c29c commit 86ece85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
14 changes: 8 additions & 6 deletions packages/react/src/components/TimePicker/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,14 @@ const TimePicker: TimePickerComponent = React.forwardRef<
const mappedChildren = React.Children.map(children, (pickerSelect) => {
const item = pickerSelect as any;

return React.cloneElement(item, {
...item.props,
disabled: disabled,
readOnly: readOnly,
...readOnlyEventHandlers,
});
if (item) {
return React.cloneElement(item, {
...item.props,
disabled: disabled,
readOnly: readOnly,
...readOnlyEventHandlers,
});
}
});

return mappedChildren;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@

.#{$prefix}--time-picker__select {
justify-content: center;

&:not(:last-of-type) {
margin: 0 $spacing-01;
}
margin-left: $spacing-01;
}

.#{$prefix}--time-picker__input {
Expand Down

0 comments on commit 86ece85

Please sign in to comment.