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

@ -43,7 +43,7 @@ signing {
}
group = 'rocks.kavin'
version = '1.0.1'
version = '1.0.2'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

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()
});