[Pkg-owncloud-commits] [qtkeychain] 66/115: The early return catches the bug

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Mar 15 19:25:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository qtkeychain.

commit a6c1f94cef9d922e10ce6ce6644ec7e5a41fd72b
Author: Frank Osterfeld <frank.osterfeld at gmail.com>
Date:   Mon Jul 22 20:01:37 2013 +0200

    The early return catches the bug
---
 keychain_dbus.cpp | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/keychain_dbus.cpp b/keychain_dbus.cpp
index d8c746b..29d263c 100644
--- a/keychain_dbus.cpp
+++ b/keychain_dbus.cpp
@@ -388,26 +388,27 @@ void WritePasswordJobPrivate::fallbackOnError(const QDBusError &err)
     std::auto_ptr<QSettings> local( !q->settings() ? new QSettings(  q->service() ) : 0 );
     QSettings* actual = q->settings() ? q->settings() : local.get();
 
-    if ( q->insecureFallback() ) {
-        if ( mode == Delete ) {
-            actual->remove( key );
-            actual->sync();
-
-            q->emitFinished();
-            return;
-        }
+    if ( !q->insecureFallback() ) {
+        q->emitFinishedWithError( OtherError, tr("Could not open wallet: %1; %2").arg( QDBusError::errorString( err.type() ), err.message() ) );
+        return;
+    }
 
-        actual->setValue( QString( "%1/type" ).arg( key ), (int)mode );
-        if ( mode == Text )
-            actual->setValue( QString( "%1/data" ).arg( key ), textData.toUtf8() );
-        else if ( mode == Binary )
-            actual->setValue( QString( "%1/data" ).arg( key ), binaryData );
+    if ( mode == Delete ) {
+        actual->remove( key );
         actual->sync();
 
         q->emitFinished();
-    } else {
-        q->emitFinishedWithError( OtherError, tr("Could not open wallet: %1; %2").arg( QDBusError::errorString( err.type() ), err.message() ) );
-   }
+        return;
+    }
+
+    actual->setValue( QString( "%1/type" ).arg( key ), (int)mode );
+    if ( mode == Text )
+        actual->setValue( QString( "%1/data" ).arg( key ), textData.toUtf8() );
+    else if ( mode == Binary )
+        actual->setValue( QString( "%1/data" ).arg( key ), binaryData );
+    actual->sync();
+
+    q->emitFinished();
 }
 
 void WritePasswordJobPrivate::gnomeKeyring_cb( int result, WritePasswordJobPrivate* self )

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/qtkeychain.git



More information about the Pkg-owncloud-commits mailing list