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
1 changed files with 3 additions and 1 deletions

View File

@ -45,8 +45,10 @@ func (smart *SMARTctlInfo) SetJSON(json gjson.Result) {
// Collect metrics
func (smart *SMARTctlInfo) Collect() {
if smart.Ready {
smart.mineVersion()
}
}
func (smart *SMARTctlInfo) mineVersion() {
smartctlJSON := smart.json.Get("smartctl")