Branch: master

2c850d93 2014-10-02 11:21:31 Timothy Pearson
Fix potential crash if CPU #0 is not available
M tdecore/tdehw/tdehardwaredevices.cpp
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp
index 3ae7479..683be07 100644
--- a/tdecore/tdehw/tdehardwaredevices.cpp
+++ b/tdecore/tdehw/tdehardwaredevices.cpp
@@ -652,7 +652,7 @@
 	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 @@
 		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);