Skip to content

Commit

Permalink
Fix Breadcrumb validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasMichon committed Apr 25, 2018
1 parent 6308b5d commit 45c7a49
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ export class Breadcrumb extends BaseComponent<IBreadcrumbProps, any> {
* @param props Props to validate
*/
private _validateProps(props: IBreadcrumbProps): void {
const { items, overflowIndex } = props;
if (overflowIndex! < 0 || overflowIndex! > items.length) {
const { maxDisplayedItems, overflowIndex, items } = props;
if (overflowIndex! < 0 ||
maxDisplayedItems! > 1 && overflowIndex! > maxDisplayedItems! - 1 ||
items.length > 0 && overflowIndex! > items.length - 1) {
throw new Error('Breadcrumb: overflowIndex out of range');
}
}
Expand Down

0 comments on commit 45c7a49

Please sign in to comment.