check for existence of options struct

Change-Id: I6509f7fc50d0f2c7d41185e1d4e986f000ea3272
This commit is contained in:
Han Kang 2021-02-19 08:35:26 -08:00
parent 51be88a845
commit 4f03514609

View File

@ -67,7 +67,10 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
// Apply applies parameters into global configuration of metrics.
func (o *Options) Apply() {
if o != nil && len(o.ShowHiddenMetricsForVersion) > 0 {
if o == nil {
return
}
if len(o.ShowHiddenMetricsForVersion) > 0 {
SetShowHidden()
}
// set disabled metrics