Added null checks.
authorMikko Keinänen <mikko.keinanen@gmail.com>
Fri, 12 Nov 2010 18:20:52 +0000 (20:20 +0200)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Fri, 12 Nov 2010 18:20:52 +0000 (20:20 +0200)
src/dataobjects/emufrontobject.cpp
src/dialogs/executableeditdialog.cpp
src/dialogs/mediaimagepathdialog.cpp
src/dialogs/setupeditdialog.cpp

index 4dd7cae..f3f1774 100644 (file)
@@ -49,7 +49,7 @@ EmuFrontObject& EmuFrontObject::operator =(const EmuFrontObject &ob)
 
 bool EmuFrontObject::operator ==(const EmuFrontObject &sup)
 {
-    return (id >= 0 && id == sup.id && name == sup.name);
+    return (id >= 0 && id == sup.id);
 }
 
 bool EmuFrontObject::operator !=(const EmuFrontObject &sup)
index 442d6c6..c62fe9f 100644 (file)
@@ -99,7 +99,7 @@ void ExecutableEditDialog::acceptChanges()
         }
         bool change = false;
         Setup *supTmp = ex->getSetup();
-        if (*supTmp != *su) {
+        if (!supTmp || *supTmp != *su) {
             delete supTmp;
             ex->setSetup(su);
             change = true;
index 5aaab3a..0a6617e 100644 (file)
@@ -134,7 +134,7 @@ void MediaImagePathDialog::acceptChanges()
     int idSup = sup->getId();
     int idTmp = tmp->getId();
 
-    if (*sup != *tmp)
+    if (!tmp || *sup != *tmp)
     {
         delete tmp;
         fpo->setSetup(sup);
index e687bf9..049512f 100644 (file)
@@ -87,14 +87,14 @@ void SetupEditDialog::acceptChanges()
 
     bool change = false;
     Platform *ptmp = sup->getPlatform();
-    if (*plf != *ptmp)
+    if (!ptmp || *plf != *ptmp)
     {
         delete ptmp;
         sup->setPlatform(plf);
         change = true;
     }
     MediaType *mtmp = sup->getMediaType();
-    if (*mt != *mtmp)
+    if (!mtmp || *mt != *mtmp)
     {
         delete mtmp;
         sup->setMediaType(mt);