Skip to content

Commit f2b423e

Browse files
committed
fix a boolean operation
1 parent 223cf5d commit f2b423e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/parser.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,9 +940,8 @@ tl::expected<url_pattern, errors> parse_url_pattern_impl(
940940

941941
// Let processedInit be the result of process a URLPatternInit given init,
942942
// "pattern", null, null, null, null, null, null, null, and null.
943-
auto processed_init = url_pattern_init::process(
944-
init, "pattern", std::nullopt, std::nullopt, std::nullopt, std::nullopt,
945-
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
943+
// TODO: Make "pattern" an enum to avoid creating a string everytime.
944+
auto processed_init = url_pattern_init::process(init, "pattern");
946945
if (!processed_init) {
947946
ada_log("url_pattern_init::process failed for init and 'pattern'");
948947
return tl::unexpected(processed_init.error());

src/url_pattern.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ tl::expected<url_pattern_init, errors> url_pattern_init::process(
120120
}
121121

122122
// If init contains neither "protocol" nor "hostname", then:
123-
if (!init.protocol || !init.hostname) {
124-
ADA_ASSERT_TRUE(base_url.has_value());
123+
if (!init.protocol && !init.hostname) {
125124
// Let baseHost be baseURL’s host.
126125
// If baseHost is null, then set baseHost to the empty string.
127126
auto base_host = base_url->get_hostname();

0 commit comments

Comments
 (0)