Fixed some cases where nullptr were not correctly handled.

This commit is contained in:
Eelke Klein 2017-09-01 21:07:37 +02:00
parent e66326472e
commit aa50d3097e
3 changed files with 18 additions and 10 deletions

View file

@ -8,10 +8,12 @@ Expected<OpenDatabase*> OpenDatabase::createOpenDatabase(const ConnectionConfig
OpenDatabase *odb = new OpenDatabase(cfg, nullptr);
if (odb->Init()) {
return odb;
}
return odb;
//return Expected<ConnectionConfig>::fromException(std::out_of_range("Invalid row"));
return Expected<OpenDatabase*>::fromException(
std::runtime_error("Failed to get database information"));
}
OpenDatabase::OpenDatabase(const ConnectionConfig& cfg, QObject *parent)
@ -33,8 +35,9 @@ bool OpenDatabase::Init()
auto vals = m_config.getValues();
if (conn.connect(kw, vals, 0)) {
m_catalogue->loadAll(conn);
return true;
}
return true;
return false;
}
PgDatabaseCatalogue* OpenDatabase::catalogue()