Fix crash when there's no response body.

This commit is contained in:
Kavin 2023-03-04 20:30:09 +00:00
parent be5ff40c97
commit 0ad3b94bc3
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
2 changed files with 2 additions and 2 deletions

View file

@ -80,7 +80,7 @@ pub extern "system" fn Java_rocks_kavin_reqwest4j_ReqwestUtils_fetch(
let final_url = env.new_string(final_url).unwrap();
let body = RUNTIME.block_on(async {
response.bytes().await.unwrap().to_vec()
response.bytes().await.unwrap_or_default().to_vec()
});