Guard against nil

This commit is contained in:
Ilia Babanov 2024-10-23 12:40:48 +02:00
parent 73e6852552
commit 5f63f7488b
No known key found for this signature in database
GPG Key ID: 17E5E4BD05551A6D
1 changed files with 4 additions and 2 deletions

View File

@ -38,8 +38,10 @@ func (f *syncFlags) syncOptionsFromBundle(cmd *cobra.Command, b *bundle.Bundle)
case flags.OutputJSON:
outputFunc = sync.JsonOutput
}
opts.OutputHandler = func(ctx context.Context, c <-chan sync.Event) {
outputFunc(ctx, c, cmd.OutOrStdout())
if outputFunc != nil {
opts.OutputHandler = func(ctx context.Context, c <-chan sync.Event) {
outputFunc(ctx, c, cmd.OutOrStdout())
}
}
}