Fix potential nil pointer problem when both watchResources and waitForBuild are equal to false (#485)

This commit is contained in:
Ta-Ching Chen
2018-02-06 15:14:47 -08:00
committed by Soam Vasani
parent e6191e3c69
commit c56ed598cb
+2 -3
View File
@@ -424,14 +424,13 @@ func specApply(c *cli.Context) error {
checkErr(err, "apply specs")
printApplyStatus(as)
var ctx context.Context
var pkgWatchCancel context.CancelFunc
if watchResources || waitForBuild {
// watch package builds
ctx, pkgWatchCancel = context.WithCancel(context.Background())
pbw.addPackages(pkgMetas)
}
ctx, pkgWatchCancel := context.WithCancel(context.Background())
if watchResources {
// if we're watching for files, we don't need to wait for builds to complete
go pbw.watch(ctx)