diff --git a/lib/internal/url.js b/lib/internal/url.js index a5e3bb96908e2e..af65358fc4f72b 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -617,7 +617,7 @@ function onParseHashComplete(flags, protocol, username, password, } function isURLThis(self) { - return self?.[context] !== undefined; + return (self !== undefined && self !== null && self[context] !== undefined); } class URL {