[postgresql] Fix crash when testing a connection fails

This commit is contained in:
nirvn 2019-08-29 11:54:01 +07:00 committed by Mathieu Pellerin
parent 2a9f215f98
commit a3ebe6a855

View File

@ -206,6 +206,8 @@ void QgsPgNewConnection::testConnection()
QgsPostgresConn *conn = QgsPostgresConn::connectDb( uri.connectionInfo( false ), true );
if ( conn )
{
if ( conn->pgVersion() < 90500 )
{
cb_projectsInDatabase->setEnabled( false );
@ -217,8 +219,6 @@ void QgsPgNewConnection::testConnection()
cb_projectsInDatabase->setToolTip( QString() );
}
if ( conn )
{
// Database successfully opened; we can now issue SQL commands.
bar->pushMessage( tr( "Connection to %1 was successful." ).arg( txtName->text() ),
Qgis::Info );