Skip to content

Commit 7990d91

Browse files
author
Conor
committed
correct handling of nullptr
1 parent b02fe3a commit 7990d91

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/core/promise.cxx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,13 @@ struct awaitable : std::suspend_always {
191191

192192
// TODO: Add tests for exception/cancellation handling in fork/call.
193193

194-
if (!self.child || parent.promise().frame.is_cancelled()) [[unlikely]] {
195-
// Noop if an exception was thrown or canceled.
196-
// Must clean-up the child that will never be resumed.
194+
if (!self.child) [[unlikely]] {
195+
// Noop if an exception was thrown.
196+
return parent;
197+
}
198+
199+
if (parent.promise().frame.is_cancelled()) [[unlikely]] {
200+
// Noop if canceled, must clean-up the child that will never be resumed.
197201
return self.child->handle().destroy(), parent;
198202
}
199203

0 commit comments

Comments
 (0)