Skip to content

Commit

Permalink
Add Error checking to prevent invalid breakpoint (#28889)
Browse files Browse the repository at this point in the history
* Add Error checking to prevent invalid breakpoint

Error checking to prevent invalid breakpoint name

* check type rather than value

* Revert "check type rather than value"

This reverts commit 04ab1e6.

* use of not rather than null
  • Loading branch information
ashfahan authored and MartijnCuppens committed Jun 17, 2019
1 parent 0829dec commit c5b1919
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scss/mixins/_breakpoints.scss
Expand Up @@ -16,7 +16,10 @@
// md
@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
$n: index($breakpoint-names, $name);
@return if($n != null and $n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
@if not $n {
@error "breakpoint `#{$name}` not found in `#{$breakpoints}`";
}
@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
}

// Minimum breakpoint width. Null for the smallest (first) breakpoint.
Expand Down

0 comments on commit c5b1919

Please sign in to comment.