mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
- small fix in SystemKit (prevent crash missing gpu name)
This commit is contained in:
@@ -157,7 +157,7 @@ public class SystemKit {
|
||||
|
||||
let result = IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching("IOPCIDevice"), &iterator)
|
||||
if result == kIOReturnSuccess {
|
||||
|
||||
|
||||
while device != 0 {
|
||||
device = IOIteratorNext(iterator)
|
||||
var serviceDictionary: Unmanaged<CFMutableDictionary>?
|
||||
@@ -172,7 +172,9 @@ public class SystemKit {
|
||||
|
||||
if let d = dict.object(forKey: "IOName") as? String {
|
||||
if d == "display" {
|
||||
let model = dict.object(forKey: "model") as! Data
|
||||
guard let model = dict.object(forKey: "model") as? Data else {
|
||||
continue
|
||||
}
|
||||
let modelName = String(data: model, encoding: .ascii)!.replacingOccurrences(of: "\0", with: "")
|
||||
gpu.append(gpu_s(name: modelName))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user