Skip to content
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

Add nil check before setting timeout on docker client #4303

Merged
merged 1 commit into from
May 22, 2018

Conversation

preetapan
Copy link
Member

Fixes #4289

@@ -1099,7 +1099,7 @@ func (d *DockerDriver) newDockerClient(timeout time.Duration) (*docker.Client, e
}
}

if timeout != 0 {
if timeout != 0 && newClient != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will the err be set in this case? Otherwise if newClient is nil and the error is nil, it seems like the caller is susceptible to a NPE too

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes the error is always set if newClient is nil. I read through the methods that return a new dockerClient in

and it always returns an error if the client is nil.

@preetapan preetapan merged commit 0fcfaab into master May 22, 2018
@preetapan preetapan deleted the b-docker-client-nil-panic branch May 22, 2018 02:34
@github-actions
Copy link

github-actions bot commented Mar 4, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants