Skip to content

Commit b177baa

Browse files
committed
Fix other instances of bad state no element (Sub6Resources#783)
1 parent ed48ee8 commit b177baa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/src/css_parser.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Style declarationsToStyle(Map<String, List<css.Expression>> declarations) {
4949
List<String> possibleBorderValues = ["dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "none", "hidden"];
5050
/// List<css.LiteralTerm> might include other values than the ones we want for [BorderSide.style], so make sure to remove those before passing it to [ExpressionMapping]
5151
potentialStyles.removeWhere((element) => element == null || !possibleBorderValues.contains(element.text));
52-
css.LiteralTerm borderStyle = potentialStyles.first!;
52+
css.LiteralTerm? borderStyle = potentialStyles.firstOrNull;
5353
Border newBorder = Border(
5454
left: style.border?.left.copyWith(
5555
width: ExpressionMapping.expressionToBorderWidth(borderWidth),
@@ -82,7 +82,7 @@ Style declarationsToStyle(Map<String, List<css.Expression>> declarations) {
8282
List<String> possibleBorderValues = ["dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "none", "hidden"];
8383
/// List<css.LiteralTerm> might include other values than the ones we want for [BorderSide.style], so make sure to remove those before passing it to [ExpressionMapping]
8484
potentialStyles.removeWhere((element) => element == null || !possibleBorderValues.contains(element.text));
85-
css.LiteralTerm borderStyle = potentialStyles.first!;
85+
css.LiteralTerm? borderStyle = potentialStyles.firstOrNull;
8686
Border newBorder = Border(
8787
left: style.border?.left ?? BorderSide.none,
8888
right: style.border?.right.copyWith(
@@ -115,7 +115,7 @@ Style declarationsToStyle(Map<String, List<css.Expression>> declarations) {
115115
List<String> possibleBorderValues = ["dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "none", "hidden"];
116116
/// List<css.LiteralTerm> might include other values than the ones we want for [BorderSide.style], so make sure to remove those before passing it to [ExpressionMapping]
117117
potentialStyles.removeWhere((element) => element == null || !possibleBorderValues.contains(element.text));
118-
css.LiteralTerm borderStyle = potentialStyles.first!;
118+
css.LiteralTerm? borderStyle = potentialStyles.firstOrNull;
119119
Border newBorder = Border(
120120
left: style.border?.left ?? BorderSide.none,
121121
right: style.border?.right ?? BorderSide.none,

0 commit comments

Comments
 (0)