Skip to content

progress can be null in CreateImageAsync #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Docker.DotNet/Endpoints/ImageOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ internal ImageOperations(DockerClient client)
return this._client.MakeRequestForStreamAsync(this._client.NoErrorHandlers, HttpMethod.Post, "build", queryParameters, data, cancellationToken);
}

public Task CreateImageAsync(ImagesCreateParameters parameters, AuthConfig authConfig, IProgress<JSONMessage> progress, CancellationToken cancellationToken = default(CancellationToken))
public Task CreateImageAsync(ImagesCreateParameters parameters, AuthConfig authConfig, IProgress<JSONMessage> progress = null, CancellationToken cancellationToken = default(CancellationToken))
{
return CreateImageAsync(parameters, null, authConfig, progress, cancellationToken);
}

public Task CreateImageAsync(ImagesCreateParameters parameters, Stream imageStream, AuthConfig authConfig, IProgress<JSONMessage> progress, CancellationToken cancellationToken = default(CancellationToken))
public Task CreateImageAsync(ImagesCreateParameters parameters, Stream imageStream, AuthConfig authConfig, IProgress<JSONMessage> progress = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (parameters == null)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Docker.DotNet/Endpoints/StreamUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ internal static async Task MonitorStreamForMessagesAsync<T>(Task<Stream> streamT
var prog = client.JsonSerializer.DeserializeObject<T>(line);
if (prog == null) continue;

progress.Report(prog);
if(progress!= null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than this we should just have the call to monitor split so we don't call monitor if we don't have a progress.

progress.Report(prog);
}
}
catch (ObjectDisposedException)
Expand Down