- fix crash when GPU module is enabled (#74)

This commit is contained in:
Serhiy Mytrovtsiy
2020-08-26 12:45:15 +02:00
parent 1d98b8cb8e
commit ab1f7ff86e
4 changed files with 21 additions and 7 deletions

View File

@@ -35,7 +35,7 @@ public struct GPUs: value_t {
public var widget_value: Double {
get {
return list[0].utilization
return list.isEmpty ? 0 : list[0].utilization
}
}
}
@@ -87,7 +87,7 @@ public class GPU: Module {
}
private func infoCallback(_ value: GPUs?) {
guard value != nil else {
guard value != nil && !value!.list.isEmpty else {
return
}