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

Fix potential nil pointer problem #485

Conversation

life1347
Copy link
Member

@life1347 life1347 commented Feb 6, 2018

Fix potential nil pointer problem when both watchResources and waitForBuild are equal to false.
I moved L431 out of if condition, it's more clean and easy to understand.

fission/fission/spec.go

Lines 427 to 433 in fe9453a

var ctx context.Context
var pkgWatchCancel context.CancelFunc
if watchResources || waitForBuild {
// watch package builds
ctx, pkgWatchCancel = context.WithCancel(context.Background())
pbw.addPackages(pkgMetas)
}

fission/fission/spec.go

Lines 443 to 446 in fe9453a

if !watchResources {
pkgWatchCancel()
break
}


This change is Reviewable

@soamvasani
Copy link
Member

LGTM, thanks, this is much better than my version.

@soamvasani soamvasani added this to the 0.5.0 milestone Feb 6, 2018
@soamvasani soamvasani merged commit c56ed59 into master Feb 6, 2018
@soamvasani soamvasani deleted the fix-nil-pointer-problem-when-both-watch-and-wait-are-false branch February 6, 2018 23:14
sarun87 pushed a commit to sarun87/fission that referenced this pull request Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants