diff --git a/src/libplctag/Tag.cs b/src/libplctag/Tag.cs index 9f2f8ff..607d701 100644 --- a/src/libplctag/Tag.cs +++ b/src/libplctag/Tag.cs @@ -718,12 +718,12 @@ public async Task InitializeAsync(CancellationToken token = default) } // Await while Pending - if(result == (int)Status.Pending) + if(GetStatus() == Status.Pending) { await createTask.Task.ConfigureAwait(false); } - // Tear down and throw on error + // On error, tear down and throw if(createTask.Task.Result != Status.Ok) { RemoveEventsAndRemoveCallback();