summaryrefslogtreecommitdiff
path: root/noncore/settings
authordrw <drw>2003-03-15 16:09:22 (UTC)
committer drw <drw>2003-03-15 16:09:22 (UTC)
commit69823b154b29cd62c9d53f7ebdaae4cb7dd61939 (patch) (side-by-side diff)
treef678ad4bb0cf7005ce00e7231713372220c75cf6 /noncore/settings
parentede78d4ab60d2c78427c4b1cc51cd9accc0aed1c (diff)
downloadopie-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.
Diffstat (limited to 'noncore/settings') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp36
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
@@ -287,4 +287,6 @@ void SettingsImpl :: editServer( int sel )
currentSelectedServer = sel;
Server *s = dataMgr->getServer( servers->currentText() );
+ if ( s )
+ {
serverName = s->getServerName();
servername->setText( s->getServerName() );
@@ -292,4 +294,12 @@ void SettingsImpl :: editServer( int sel )
active->setChecked( s->isServerActive() );
}
+ else
+ {
+ serverName = "";
+ servername->setText( "" );
+ serverurl->setText( "" );
+ active->setChecked( false );
+ }
+}
void SettingsImpl :: newServer()
@@ -306,7 +316,10 @@ void SettingsImpl :: removeServer()
changed = true;
Server *s = dataMgr->getServer( servers->currentText() );
+ if ( s )
+ {
dataMgr->getServerList().removeRef( s );
servers->removeItem( currentSelectedServer );
}
+}
void SettingsImpl :: changeServerDetails()
@@ -333,10 +346,10 @@ void SettingsImpl :: changeServerDetails()
{
Server *s = dataMgr->getServer( servers->currentText() );
-
+ if ( s )
+ {
// Update url
s->setServerUrl( serverurl->text() );
s->setActive( active->isChecked() );
-
// Check if server name has changed, if it has then we need to replace the key in the map
if ( serverName != newName )
@@ -349,4 +362,5 @@ void SettingsImpl :: changeServerDetails()
servers->changeItem( newName, currentSelectedServer );
}
+ }
else
{
@@ -366,4 +380,6 @@ void SettingsImpl :: editDestination( int sel )
currentSelectedDestination = sel;
Destination *d = dataMgr->getDestination( destinations->currentText() );
+ if ( d )
+ {
destinationName = d->getDestinationName();
destinationname->setText( d->getDestinationName() );
@@ -371,4 +387,12 @@ void SettingsImpl :: editDestination( int sel )
linkToRoot->setChecked( d->linkToRoot() );
}
+ else
+ {
+ destinationName = "";
+ destinationname->setText( "" );
+ destinationurl->setText( "" );
+ linkToRoot->setChecked( false );
+ }
+}
void SettingsImpl :: newDestination()
@@ -385,7 +409,10 @@ void SettingsImpl :: removeDestination()
changed = true;
Destination *d = dataMgr->getDestination( destinations->currentText() );
+ if ( d )
+ {
dataMgr->getDestinationList().removeRef( d );
destinations->removeItem( currentSelectedDestination );
}
+}
void SettingsImpl :: changeDestinationDetails()
@@ -402,5 +429,6 @@ void SettingsImpl :: changeDestinationDetails()
{
Destination *d = dataMgr->getDestination( destinations->currentText() );
-
+ if ( d )
+ {
// Update url
d->setDestinationPath( destinationurl->text() );
@@ -416,4 +444,5 @@ void SettingsImpl :: changeDestinationDetails()
destinations->changeItem( newName, currentSelectedDestination );
}
+
#ifdef QWS
QString key = newName;
@@ -423,4 +452,5 @@ void SettingsImpl :: changeDestinationDetails()
#endif
}
+ }
else
{