author | drw <drw> | 2003-03-15 16:09:22 (UTC) |
---|---|---|
committer | drw <drw> | 2003-03-15 16:09:22 (UTC) |
commit | 69823b154b29cd62c9d53f7ebdaae4cb7dd61939 (patch) (unidiff) | |
tree | f678ad4bb0cf7005ce00e7231713372220c75cf6 /noncore/settings | |
parent | ede78d4ab60d2c78427c4b1cc51cd9accc0aed1c (diff) | |
download | opie-69823b154b29cd62c9d53f7ebdaae4cb7dd61939.zip opie-69823b154b29cd62c9d53f7ebdaae4cb7dd61939.tar.gz opie-69823b154b29cd62c9d53f7ebdaae4cb7dd61939.tar.bz2 |
Added several checks to ensure we have a valid server or destination. Fixes bug #727, and also prevents several other segfault situations.
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 9f611da..e2afada 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp | |||
@@ -288,2 +288,4 @@ void SettingsImpl :: editServer( int sel ) | |||
288 | Server *s = dataMgr->getServer( servers->currentText() ); | 288 | Server *s = dataMgr->getServer( servers->currentText() ); |
289 | if ( s ) | ||
290 | { | ||
289 | serverName = s->getServerName(); | 291 | serverName = s->getServerName(); |
@@ -293,2 +295,10 @@ void SettingsImpl :: editServer( int sel ) | |||
293 | } | 295 | } |
296 | else | ||
297 | { | ||
298 | serverName = ""; | ||
299 | servername->setText( "" ); | ||
300 | serverurl->setText( "" ); | ||
301 | active->setChecked( false ); | ||
302 | } | ||
303 | } | ||
294 | 304 | ||
@@ -307,2 +317,4 @@ void SettingsImpl :: removeServer() | |||
307 | Server *s = dataMgr->getServer( servers->currentText() ); | 317 | Server *s = dataMgr->getServer( servers->currentText() ); |
318 | if ( s ) | ||
319 | { | ||
308 | dataMgr->getServerList().removeRef( s ); | 320 | dataMgr->getServerList().removeRef( s ); |
@@ -310,2 +322,3 @@ void SettingsImpl :: removeServer() | |||
310 | } | 322 | } |
323 | } | ||
311 | 324 | ||
@@ -334,3 +347,4 @@ void SettingsImpl :: changeServerDetails() | |||
334 | Server *s = dataMgr->getServer( servers->currentText() ); | 347 | Server *s = dataMgr->getServer( servers->currentText() ); |
335 | 348 | if ( s ) | |
349 | { | ||
336 | // Update url | 350 | // Update url |
@@ -339,3 +353,2 @@ void SettingsImpl :: changeServerDetails() | |||
339 | 353 | ||
340 | |||
341 | // Check if server name has changed, if it has then we need to replace the key in the map | 354 | // Check if server name has changed, if it has then we need to replace the key in the map |
@@ -350,2 +363,3 @@ void SettingsImpl :: changeServerDetails() | |||
350 | } | 363 | } |
364 | } | ||
351 | else | 365 | else |
@@ -367,2 +381,4 @@ void SettingsImpl :: editDestination( int sel ) | |||
367 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 381 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
382 | if ( d ) | ||
383 | { | ||
368 | destinationName = d->getDestinationName(); | 384 | destinationName = d->getDestinationName(); |
@@ -372,2 +388,10 @@ void SettingsImpl :: editDestination( int sel ) | |||
372 | } | 388 | } |
389 | else | ||
390 | { | ||
391 | destinationName = ""; | ||
392 | destinationname->setText( "" ); | ||
393 | destinationurl->setText( "" ); | ||
394 | linkToRoot->setChecked( false ); | ||
395 | } | ||
396 | } | ||
373 | 397 | ||
@@ -386,2 +410,4 @@ void SettingsImpl :: removeDestination() | |||
386 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 410 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
411 | if ( d ) | ||
412 | { | ||
387 | dataMgr->getDestinationList().removeRef( d ); | 413 | dataMgr->getDestinationList().removeRef( d ); |
@@ -389,2 +415,3 @@ void SettingsImpl :: removeDestination() | |||
389 | } | 415 | } |
416 | } | ||
390 | 417 | ||
@@ -403,3 +430,4 @@ void SettingsImpl :: changeDestinationDetails() | |||
403 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 430 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
404 | 431 | if ( d ) | |
432 | { | ||
405 | // Update url | 433 | // Update url |
@@ -417,2 +445,3 @@ void SettingsImpl :: changeDestinationDetails() | |||
417 | } | 445 | } |
446 | |||
418 | #ifdef QWS | 447 | #ifdef QWS |
@@ -424,2 +453,3 @@ void SettingsImpl :: changeDestinationDetails() | |||
424 | } | 453 | } |
454 | } | ||
425 | else | 455 | else |