Skip to content

Commit

Permalink
Fix getting hash if separator not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mykolaxgerasymenko committed Mar 18, 2021
1 parent 2417099 commit 6eab00e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions common/configdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,11 @@ map<string, map<string, string>> ConfigDBConnector_Native::get_table(string tabl
auto const& entry = client.hgetall<map<string, string>>(key);
size_t pos = key.find(TABLE_NAME_SEPARATOR);
string row;
if (pos != string::npos)
if (pos == string::npos)
{
row = key.substr(pos + 1);
continue;
}
row = key.substr(pos + 1);
data[row] = entry;
}
return data;
Expand Down Expand Up @@ -410,10 +411,11 @@ int ConfigDBPipeConnector_Native::_get_config(DBConnector& client, RedisTransact
size_t pos = key.find(TABLE_NAME_SEPARATOR);
string table_name = key.substr(0, pos);
string row;
if (pos != string::npos)
if (pos == string::npos)
{
row = key.substr(pos + 1);
continue;
}
row = key.substr(pos + 1);

auto reply = pipe.dequeueReply();
RedisReply r(reply);
Expand Down

0 comments on commit 6eab00e

Please sign in to comment.