about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-01-04 14:37:28 +0100
committerbptato <nincsnevem662@gmail.com>2024-01-04 14:37:28 +0100
commitb7202e259ae4b513219a0c0bb7e3675d9717c325 (patch)
tree1aff8c62170d2ffffb603c4f313aef171ea00885 /src/css
parent2c3e1f0e7ba94cffc30ffb90b159234979824672 (diff)
downloadchawan-b7202e259ae4b513219a0c0bb7e3675d9717c325.tar.gz
css/sheet: skip media queries without blocks
Without this, media queries without a block would crash the buffer.
Diffstat (limited to 'src/css')
-rw-r--r--src/css/sheet.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/css/sheet.nim b/src/css/sheet.nim
index bf38c918..0447c23d 100644
--- a/src/css/sheet.nim
+++ b/src/css/sheet.nim
@@ -185,6 +185,9 @@ proc addRule(stylesheet: var CSSStylesheet, rule: CSSQualifiedRule) =
 proc addAtRule(stylesheet: var CSSStylesheet, atrule: CSSAtRule) =
   case atrule.name
   of "media":
+    if atrule.oblock == nil:
+      # invalid at-rule
+      return
     let query = parseMediaQueryList(atrule.prelude)
     let rules = atrule.oblock.value.parseListOfRules()
     if rules.len > 0: