]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add Error checking to prevent invalid breakpoint (#28889)
authorAshfahan Khan <me@ashfahan.com>
Mon, 17 Jun 2019 06:00:36 +0000 (11:00 +0500)
committerMartijn Cuppens <martijn.cuppens@gmail.com>
Mon, 17 Jun 2019 06:00:36 +0000 (08:00 +0200)
* 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 04ab1e652f9c9c1c7725b7328b12f548a2c6d142.

* use of not rather than null

scss/mixins/_breakpoints.scss

index 23a5de96be0dfd0bcbf342a67ef62b1039500a77..81f8ffb2819a3bbdb3afa0e1fe71803470f0d477 100644 (file)
 //    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.