diff --git a/cmdline/mingw.c b/cmdline/mingw.c index e6199c3a..9eed2817 100644 --- a/cmdline/mingw.c +++ b/cmdline/mingw.c @@ -2818,8 +2818,9 @@ retry: log_tag("attr:%s:%s:power:active\n", file, name); *power = POWER_ACTIVE; - /* store the return smartctl return value */ - smart[SMART_FLAGS].raw = WEXITSTATUS(ret); + /* store the smartctl return value */ + if (smart) + smart[SMART_FLAGS].raw = WEXITSTATUS(ret); } return 0; diff --git a/cmdline/unix.c b/cmdline/unix.c index 90eea103..6b57b846 100644 --- a/cmdline/unix.c +++ b/cmdline/unix.c @@ -1794,8 +1794,9 @@ static int devprobe(dev_t device, const char* name, const char* smartctl, int* p log_tag("attr:%s:%s:power:active\n", file, name); *power = POWER_ACTIVE; - /* store the return smartctl return value */ - smart[SMART_FLAGS].raw = WEXITSTATUS(ret); + /* store the smartctl return value */ + if (smart) + smart[SMART_FLAGS].raw = WEXITSTATUS(ret); } return 0;