Skip to content

Commit

Permalink
Merge c0164f7 into 0718e04
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikaalund committed Jul 16, 2020
2 parents 0718e04 + c0164f7 commit 6ff076d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rx/core/operators/tofuture.py
Expand Up @@ -42,10 +42,11 @@ def on_error(err):

def on_completed():
nonlocal last_value
if has_value:
future.set_result(last_value)
else:
future.set_exception(SequenceContainsNoElementsError())
if not future.cancelled():
if has_value:
future.set_result(last_value)
else:
future.set_exception(SequenceContainsNoElementsError())
last_value = None

source.subscribe_(on_next, on_error, on_completed, scheduler=scheduler)
Expand Down

0 comments on commit 6ff076d

Please sign in to comment.