Merge pull request #494 from Cysharp/hadashiA/web-req-null-check

Add check if UnityWebRequest was destroyed
master
hadashiA 2023-09-07 18:13:46 +09:00 committed by GitHub
commit f203b6c051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -900,7 +900,11 @@ namespace Cysharp.Threading.Tasks
if (asyncOperation.isDone)
{
if (asyncOperation.webRequest.IsError())
if (asyncOperation.webRequest == null)
{
core.TrySetException(new ObjectDisposedException("The webRequest has been destroyed."));
}
else if (asyncOperation.webRequest.IsError())
{
core.TrySetException(new UnityWebRequestException(asyncOperation.webRequest));
}