summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2014-10-02 11:21:31 -0500
committerTimothy Pearson <[email protected]>2014-10-02 11:21:31 -0500
commit2c850d93a7803e435504fe9c982cb974695d7a3b (patch)
tree22ba7411361c0f74ccd40d2a42aa51272cdc40c5
parent54578ce023227543f531a56fcc178b9e95e9ab5e (diff)
downloadtdelibs-2c850d93a7803e435504fe9c982cb974695d7a3b.tar.gz
tdelibs-2c850d93a7803e435504fe9c982cb974695d7a3b.zip
Fix potential crash if CPU #0 is not available
-rw-r--r--tdecore/tdehw/tdehardwaredevices.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp
index 3ae7479ab..683be0720 100644
--- a/tdecore/tdehw/tdehardwaredevices.cpp
+++ b/tdecore/tdehw/tdehardwaredevices.cpp
@@ -652,7 +652,7 @@ void TDEHardwareDevices::processModifiedCPUs() {
time1 = time2;
#endif
- TDECPUDevice* firstCPU;
+ TDECPUDevice* firstCPU = NULL;
// Read in other information from cpufreq, if available
for (processorNumber=0; processorNumber<processorCount; processorNumber++) {
@@ -668,10 +668,10 @@ void TDEHardwareDevices::processModifiedCPUs() {
TQStringList governorlist;
if (cpufreq_dir.exists()) {
TQString nodename;
- if(processorNumber == 0) {
+ if ((processorNumber == 0) || (!firstCPU)) {
// Remember the first CPU options so that we can reuse it later.
firstCPU = cdevice;
-
+
nodename = cpufreq_dir.path();
nodename.append("/scaling_governor");
TQFile scalinggovernorfile(nodename);