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

Add check if UnityWebRequest was destroyed
This commit is contained in:
hadashiA
2023-09-07 18:13:46 +09:00
committed by GitHub

View File

@@ -900,7 +900,11 @@ namespace Cysharp.Threading.Tasks
if (asyncOperation.isDone) 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)); core.TrySetException(new UnityWebRequestException(asyncOperation.webRequest));
} }