# HG changeset patch # User cin # Date 2015-02-12 23:08:01 # Node ID 656815cb7147f8f912f6cf6debc4f7d1fd0420c7 # Parent 04d4c92d0f28562655eb67672d696354dc284d3e Fixed chaining of promises with 'Then' method diff --git a/Implab/PromiseT.cs b/Implab/PromiseT.cs --- a/Implab/PromiseT.cs +++ b/Implab/PromiseT.cs @@ -349,18 +349,24 @@ namespace Implab { public IPromise Then(Func mapper, Func error, Func cancel) { var promise = new Promise(); + if (mapper != null) + promise.On(Cancel, PromiseEventType.Cancelled); AddHandler(new RemapDescriptor(mapper, error, cancel, promise)); return promise; } public IPromise Then(Func mapper, Func error) { var promise = new Promise(); + if (mapper != null) + promise.On(Cancel, PromiseEventType.Cancelled); AddHandler(new RemapDescriptor(mapper, error, null, promise)); return promise; } public IPromise Then(Func mapper) { var promise = new Promise(); + if (mapper != null) + promise.On(Cancel, PromiseEventType.Cancelled); AddHandler(new RemapDescriptor(mapper, null, null, promise)); return promise; }