Fix a crash caused by `:host()` without an argument

Parsing `:host()` without an argument now emits an error explaining that a
selector argument is expected, rather than crashing.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85453d4..5ec92f6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+* Fixed a crashed caused by parsing `:host()` without an argument and added an
+  error message explaining that a selector argument is expected.
+
 ## 0.14.4+1
 
 * Set max SDK version to `<3.0.0`, and adjust other dependencies.
diff --git a/lib/parser.dart b/lib/parser.dart
index db2068c..d0b8aea 100644
--- a/lib/parser.dart
+++ b/lib/parser.dart
@@ -1379,12 +1379,15 @@
   /// supports Selector Level 4 grammar:
   /// https://drafts.csswg.org/selectors-4/#typedef-compound-selector
   Selector processCompoundSelector() {
-    return processSelector()
-      ..simpleSelectorSequences.forEach((sequence) {
+    var selector = processSelector();
+    if (selector != null) {
+      for (var sequence in selector.simpleSelectorSequences) {
         if (!sequence.isCombinatorNone) {
           _error('compound selector can not contain combinator', sequence.span);
         }
-      });
+      }
+    }
+    return selector;
   }
 
   simpleSelectorSequence(bool forceCombinatorNone) {
@@ -1625,6 +1628,10 @@
       } else if (!pseudoElement && (name == 'host' || name == 'host-context')) {
         _eat(TokenKind.LPAREN);
         var selector = processCompoundSelector();
+        if (selector == null) {
+          _errorExpected('a selector argument');
+          return null;
+        }
         _eat(TokenKind.RPAREN);
         var span = _makeSpan(start);
         return new PseudoClassFunctionSelector(pseudoName, selector, span);
diff --git a/test/selector_test.dart b/test/selector_test.dart
index 66e2080..b2feed4 100644
--- a/test/selector_test.dart
+++ b/test/selector_test.dart
@@ -82,6 +82,13 @@
       'found a number\n'
       '.foobar .1a-story .xyzzy\n'
       '        ^^');
+
+  selector(':host()', errors: errors..clear());
+  expect(
+      errors.first.toString(),
+      'error on line 1, column 7: expected a selector argument, but found )\n'
+      ':host()\n'
+      '      ^');
 }
 
 main() {