summaryrefslogtreecommitdiffstats
path: root/tdecore
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2016-01-27 23:12:46 +0100
committerSlávek Banko <slavek.banko@axis.cz>2016-01-27 23:12:46 +0100
commitf4fb3a8e71882fec8beffccf0ba3c5eb54310c89 (patch)
treeb6f41d2fa580c78ebeaa4d21b96782133eefd664 /tdecore
parent6dfc04c51a9c2086e2f6a4be75ec847e8ef9f6fb (diff)
downloadtdelibs-f4fb3a8e71882fec8beffccf0ba3c5eb54310c89.tar.gz
tdelibs-f4fb3a8e71882fec8beffccf0ba3c5eb54310c89.zip
Fix crash in tdehwlib if not exists /sys/devices/system/cpu
This resolves Bug 2584 Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'tdecore')
-rw-r--r--tdecore/tdehw/tdehardwaredevices.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp
index 476605344..f121bec3c 100644
--- a/tdecore/tdehw/tdehardwaredevices.cpp
+++ b/tdecore/tdehw/tdehardwaredevices.cpp
@@ -3597,21 +3597,23 @@ void TDEHardwareDevices::addCoreSystemDevices() {
TQDir d("/sys/devices/system/cpu/");
d.setFilter( TQDir::Dirs );
const TQFileInfoList *list = d.entryInfoList();
- TQFileInfoListIterator it( *list );
- TQFileInfo *fi;
- while ((fi = it.current()) != 0) {
- TQString directoryName = fi->fileName();
- if (directoryName.startsWith("cpu")) {
- directoryName = directoryName.remove(0,3);
- bool isInt;
- int processorNumber = directoryName.toUInt(&isInt, 10);
- if (isInt) {
- hwdevice = new TDECPUDevice(TDEGenericDeviceType::CPU);
- hwdevice->internalSetSystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber));
- m_deviceList.append(hwdevice);
+ if (list) {
+ TQFileInfoListIterator it( *list );
+ TQFileInfo *fi;
+ while ((fi = it.current()) != 0) {
+ TQString directoryName = fi->fileName();
+ if (directoryName.startsWith("cpu")) {
+ directoryName = directoryName.remove(0,3);
+ bool isInt;
+ int processorNumber = directoryName.toUInt(&isInt, 10);
+ if (isInt) {
+ hwdevice = new TDECPUDevice(TDEGenericDeviceType::CPU);
+ hwdevice->internalSetSystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber));
+ m_deviceList.append(hwdevice);
+ }
}
+ ++it;
}
- ++it;
}
// Populate CPU information