[tor-commits] [vidalia/alpha] Fix segfault when having a problem applying a setting

chiiph at torproject.org chiiph at torproject.org
Thu Jul 5 00:13:45 UTC 2012


commit 01bec8f678dfde6c3129a00ec776156b150cdf23
Author: Tomás Touceda <chiiph at torproject.org>
Date:   Wed Jul 4 19:12:05 2012 -0300

    Fix segfault when having a problem applying a setting
---
 src/vidalia/config/torrc/Torrc.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/vidalia/config/torrc/Torrc.cpp b/src/vidalia/config/torrc/Torrc.cpp
index 8a7be47..7fa0333 100644
--- a/src/vidalia/config/torrc/Torrc.cpp
+++ b/src/vidalia/config/torrc/Torrc.cpp
@@ -46,7 +46,8 @@ Torrc::apply(TorControl *tc, QString *errmsg)
   QFileInfo torrc_info(torrc);
 
   if(!torrc.open(QIODevice::WriteOnly)) {
-    *errmsg = "Couldn't open torrc file";
+    if (errmsg)
+      *errmsg = "Couldn't open torrc file";
     return false;
   }
 
@@ -96,7 +97,8 @@ Torrc::apply(TorControl *tc, QString *errmsg)
                     .arg(key).arg(ferrmsg));
               somefailed = true;
             } else {
-              *errmsg = ferrmsg;
+              if (errmsg)
+                *errmsg = ferrmsg;
               return false;
             }
           }





More information about the tor-commits mailing list