Avoid running mineVersion when the SMARTctlInfo struct is not ready

Signed-off-by: Jakub Klinkovský <j.l.k@gmx.com>
This commit is contained in:
Jakub Klinkovský 2022-11-04 19:58:12 +01:00
parent 6e2143ca62
commit a35f67bb0f

View file

@ -45,7 +45,9 @@ func (smart *SMARTctlInfo) SetJSON(json gjson.Result) {
// Collect metrics // Collect metrics
func (smart *SMARTctlInfo) Collect() { func (smart *SMARTctlInfo) Collect() {
smart.mineVersion() if smart.Ready {
smart.mineVersion()
}
} }
func (smart *SMARTctlInfo) mineVersion() { func (smart *SMARTctlInfo) mineVersion() {