Add check if UnityWebRequest was destroyed

pull/494/head
hadashiA 2023-09-07 10:35:48 +09:00
parent 548d56e654
commit 9135c7ce56
1 changed files with 5 additions and 1 deletions

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