Skip to content

Commit c4e449f

Browse files
committed
add null check for when there is no response
1 parent d51fad2 commit c4e449f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/autodiscovery.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,12 @@ export class AutoDiscovery {
502502
request(
503503
{ method: "GET", uri: url, timeout: 5000 },
504504
(err, response, body) => {
505-
if (err || response.statusCode < 200 || response.statusCode >= 300) {
505+
if (err || response &&
506+
(response.statusCode < 200 || response.statusCode >= 300)
507+
) {
506508
let action = "FAIL_PROMPT";
507509
let reason = (err ? err.message : null) || "General failure";
508-
if (response.statusCode === 404) {
510+
if (response && response.statusCode === 404) {
509511
action = "IGNORE";
510512
reason = AutoDiscovery.ERROR_MISSING_WELLKNOWN;
511513
}

0 commit comments

Comments
 (0)