[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/soprano/backends/virtuoso
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2010-08-02 14:05:34
Message-ID: 20100802140534.433C2AC7CA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1158320 by trueg:

Check the value of the connection, thus do not crash when we failed to connect.

 M  +7 -1      virtuosobackend.cpp  


--- trunk/kdesupport/soprano/backends/virtuoso/virtuosobackend.cpp #1158319:1158320
@@ -96,10 +96,16 @@
     ODBC::ConnectionPool* connectionPool = new ODBC::ConnectionPool( connectString );
 
     // FIXME: should configuration only be allowed on spawned servers?
-    ODBC::Connection* conn = connectionPool->connection();
+    if ( ODBC::Connection* conn = connectionPool->connection() ) {
     DatabaseConfigurator configurator( conn );
     configurator.configureServer( settings );
     delete conn;
+    }
+    else {
+        qDebug() << Q_FUNC_INFO << "Failed to connect to" << connectString;
+        delete connectionPool;
+        return 0;
+    }
 
     VirtuosoModel* model = new VirtuosoModel( connectionPool, this );
     // mem mangement the ugly way
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic