summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/devicesinfo.cpp
authorerik <erik>2007-01-24 19:54:07 (UTC)
committer erik <erik>2007-01-24 19:54:07 (UTC)
commit89e81059e832ff77c2f0ac8b9db12f80eafa03fc (patch) (unidiff)
tree99a130fc643d2aeefdecab452f644e7b61a5f50e /noncore/settings/sysinfo/devicesinfo.cpp
parent035bbc5bf689839c8d8e7be37f347b0dd900fccf (diff)
downloadopie-89e81059e832ff77c2f0ac8b9db12f80eafa03fc.zip
opie-89e81059e832ff77c2f0ac8b9db12f80eafa03fc.tar.gz
opie-89e81059e832ff77c2f0ac8b9db12f80eafa03fc.tar.bz2
Each file in this commit has an instance where a pointer is checked at
one point in the code and then not checked in another point in the code. If it needed to be checked once, it needs to be checked the other time. If not the application could segfault.
Diffstat (limited to 'noncore/settings/sysinfo/devicesinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 164d608..428cfd4 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -244,49 +244,49 @@ void UsbCategory::populate()
244 int usbcount = 0; 244 int usbcount = 0;
245 UsbDevice* lastDev = 0; 245 UsbDevice* lastDev = 0;
246 UsbDevice* dev = 0; 246 UsbDevice* dev = 0;
247 while ( !usbinfo.atEnd() ) 247 while ( !usbinfo.atEnd() )
248 { 248 {
249 QString line = usbinfo.readLine(); 249 QString line = usbinfo.readLine();
250 odebug << "got line '" << line << "'" << oendl; 250 odebug << "got line '" << line << "'" << oendl;
251 if ( line.startsWith( "T:" ) ) 251 if ( line.startsWith( "T:" ) )
252 { 252 {
253 sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels); 253 sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels);
254 254
255 if ( !_level ) 255 if ( !_level )
256 { 256 {
257 odebug << "adding new bus" << oendl; 257 odebug << "adding new bus" << oendl;
258 dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); 258 dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) );
259 lastDev = dev; 259 lastDev = dev;
260 } 260 }
261 else 261 else
262 { 262 {
263 odebug << "adding new dev" << oendl; 263 odebug << "adding new dev" << oendl;
264 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); 264 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) );
265 lastDev = dev; 265 lastDev = dev;
266 } 266 }
267 } 267 }
268 else if ( line.startsWith( "S: Product" ) ) 268 else if ( dev && line.startsWith( "S: Product" ) )
269 { 269 {
270 int dp = line.find( '=' ); 270 int dp = line.find( '=' );
271 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); 271 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" );
272 } 272 }
273 else 273 else
274 { 274 {
275 continue; 275 continue;
276 } 276 }
277 } 277 }
278} 278}
279 279
280 280
281//================================================================================================= 281//=================================================================================================
282Device::Device( Category* parent, const QString& name ) 282Device::Device( Category* parent, const QString& name )
283 :OListViewItem( parent, name ) 283 :OListViewItem( parent, name )
284{ 284{
285 devinfo = static_cast<QWidget*>( listView()->parent() ); 285 devinfo = static_cast<QWidget*>( listView()->parent() );
286} 286}
287 287
288Device::Device( Device* parent, const QString& name ) 288Device::Device( Device* parent, const QString& name )
289 :OListViewItem( parent, name ) 289 :OListViewItem( parent, name )
290{ 290{
291 devinfo = static_cast<QWidget*>( listView()->parent() ); 291 devinfo = static_cast<QWidget*>( listView()->parent() );
292} 292}