author | drw <drw> | 2003-03-15 16:09:22 (UTC) |
---|---|---|
committer | drw <drw> | 2003-03-15 16:09:22 (UTC) |
commit | 69823b154b29cd62c9d53f7ebdaae4cb7dd61939 (patch) (side-by-side diff) | |
tree | f678ad4bb0cf7005ce00e7231713372220c75cf6 | |
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 ) Server *s = dataMgr->getServer( servers->currentText() ); + if ( s ) + { serverName = s->getServerName(); @@ -293,2 +295,10 @@ void SettingsImpl :: editServer( int sel ) } + else + { + serverName = ""; + servername->setText( "" ); + serverurl->setText( "" ); + active->setChecked( false ); + } +} @@ -307,2 +317,4 @@ void SettingsImpl :: removeServer() Server *s = dataMgr->getServer( servers->currentText() ); + if ( s ) + { dataMgr->getServerList().removeRef( s ); @@ -310,2 +322,3 @@ void SettingsImpl :: removeServer() } +} @@ -334,3 +347,4 @@ void SettingsImpl :: changeServerDetails() Server *s = dataMgr->getServer( servers->currentText() ); - + if ( s ) + { // Update url @@ -339,3 +353,2 @@ void SettingsImpl :: changeServerDetails() - // 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() } + } else @@ -367,2 +381,4 @@ void SettingsImpl :: editDestination( int sel ) Destination *d = dataMgr->getDestination( destinations->currentText() ); + if ( d ) + { destinationName = d->getDestinationName(); @@ -372,2 +388,10 @@ void SettingsImpl :: editDestination( int sel ) } + else + { + destinationName = ""; + destinationname->setText( "" ); + destinationurl->setText( "" ); + linkToRoot->setChecked( false ); + } +} @@ -386,2 +410,4 @@ void SettingsImpl :: removeDestination() Destination *d = dataMgr->getDestination( destinations->currentText() ); + if ( d ) + { dataMgr->getDestinationList().removeRef( d ); @@ -389,2 +415,3 @@ void SettingsImpl :: removeDestination() } +} @@ -403,3 +430,4 @@ void SettingsImpl :: changeDestinationDetails() Destination *d = dataMgr->getDestination( destinations->currentText() ); - + if ( d ) + { // Update url @@ -417,2 +445,3 @@ void SettingsImpl :: changeDestinationDetails() } + #ifdef QWS @@ -424,2 +453,3 @@ void SettingsImpl :: changeDestinationDetails() } + } else |