diff --git a/PuppeteerSharp.Dom/AsyncDomExtensions.cs b/PuppeteerSharp.Dom/AsyncDomExtensions.cs index f949459..77553d9 100644 --- a/PuppeteerSharp.Dom/AsyncDomExtensions.cs +++ b/PuppeteerSharp.Dom/AsyncDomExtensions.cs @@ -164,7 +164,7 @@ public static async Task AndThen(this Task inputTask, Func var result = await func(input).ConfigureAwait(false); - if (dispose) + if (dispose && input != null) { await input.DisposeAsync().ConfigureAwait(false); }