Skip to content

Commit

Permalink
Prevent error when response is null (#1699)
Browse files Browse the repository at this point in the history
Fix for this error.

TypeError: Cannot read properties of null (reading 'body')
  • Loading branch information
labnol committed Jan 23, 2023
1 parent 6e9464d commit 0f1ebb0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.js
Expand Up @@ -135,7 +135,9 @@ export default function fetch(url, opts) {
return
}

destroyStream(response.body, err);
if (response && response.body) {
destroyStream(response.body, err);
}
});

/* c8 ignore next 18 */
Expand Down

0 comments on commit 0f1ebb0

Please sign in to comment.