8000 Prevent error when response is null (#1699) · node-fetch/node-fetch@0f1ebb0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f1ebb0

Browse files
authored
Prevent error when response is null (#1699)
Fix for this error. TypeError: Cannot read properties of null (reading 'body')
1 parent 6e9464d commit 0f1ebb0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ export default function fetch(url, opts) {
135135
return
136136
}
137137

138-
destroyStream(response.body, err);
138+
if (response && response.body) {
139+
destroyStream(response.body, err);
140+
}
139141
});
140142

141143
/* c8 ignore next 18 */

0 commit comments

Comments
 (0)
0