Fixed some cases where nullptr were not correctly handled.
This commit is contained in:
parent
e66326472e
commit
aa50d3097e
3 changed files with 18 additions and 10 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue