Skip to content

Commit

Permalink
Merge PR #2640: ServerDB: ensure 'id' is never uninitialized in Serve…
Browse files Browse the repository at this point in the history
…r::removeChannelDB().
  • Loading branch information
mkrautz committed Nov 17, 2016
2 parents e2ad9c0 + 175ddb6 commit e9f3c08
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/murmur/ServerDB.cpp
Expand Up @@ -1652,7 +1652,7 @@ void Server::updateChannel(const Channel *c) {
SQLEXEC();

foreach(g, c->qhGroups) {
int id;
int id = 0;
int pid;

if (Meta::mp.qsDBDriver == "QPSQL") {
Expand All @@ -1664,8 +1664,11 @@ void Server::updateChannel(const Channel *c) {
query.addBindValue(g->bInheritable ? 1 : 0);
SQLEXEC();

if (query.next())
if (query.next()) {
id = query.value(0).toInt();
} else {
qFatal("ServerDB: internal query failure: PostgreSQL query did not return the inserted group's group_id");
}
} else {
SQLPREP("INSERT INTO `%1groups` (`server_id`, `channel_id`, `name`, `inherit`, `inheritable`) VALUES (?,?,?,?,?)");
query.addBindValue(iServerNum);
Expand Down

0 comments on commit e9f3c08

Please sign in to comment.