diff --git a/src/danog/MadelineProto/Coroutine.php b/src/danog/MadelineProto/Coroutine.php index ccbbb4fef..ca99eab0f 100644 --- a/src/danog/MadelineProto/Coroutine.php +++ b/src/danog/MadelineProto/Coroutine.php @@ -87,9 +87,9 @@ final class Coroutine implements Promise, \ArrayAccess } else { $yielded = $this->generator->send($yielded); } - if ($yielded instanceof self) { - $yielded->parentCoroutine = $this; - } + } + if ($yielded instanceof self) { + $yielded->parentCoroutine = $this; } } catch (\Throwable $exception) { $this->fail($exception);