PhysicalDisk (macOS): fix a possible segfault

This commit is contained in:
李通洲
2023-12-28 13:41:40 +08:00
parent e5e70c1d92
commit 36bce8fb0e
@@ -126,7 +126,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
if (options->temp)
{
FF_CFTYPE_AUTO_RELEASE CFBooleanRef nvmeSMARTCapable = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyNVMeSMARTCapableKey), kCFAllocatorDefault, kNilOptions);
if (CFBooleanGetValue(nvmeSMARTCapable))
if (nvmeSMARTCapable && CFBooleanGetValue(nvmeSMARTCapable))
detectSsdTemp(entryPhysical, &device->temperature);
}
}