Skip to content

Commit

Permalink
Fixed minor issue found by Coverity [#CLICKHOUSE-3285].
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-milovidov committed Sep 8, 2017
1 parent 8738adf commit ed1c082
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions dbms/src/Storages/System/StorageSystemGraphite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
namespace DB
{

namespace ErrorCodes
{
extern const int NO_ELEMENTS_IN_CONFIG;
}

namespace
{

Expand Down Expand Up @@ -42,7 +47,11 @@ static Pattern readOnePattern(

config.keys(path, keys);

for (const auto & key : keys) {
if (keys.empty())
throw Exception("Empty pattern in Graphite rollup configuration", ErrorCodes::NO_ELEMENTS_IN_CONFIG);

for (const auto & key : keys)
{
const String key_path = path + "." + key;

if (startsWith(key, "regexp"))
Expand Down Expand Up @@ -74,7 +83,8 @@ static std::vector<Pattern> readPatterns(

config.keys(section, keys);

for (const auto & key : keys) {
for (const auto & key : keys)
{
if (startsWith(key, "pattern"))
{
Pattern pattern(readOnePattern(config, section + "." + key));
Expand Down

0 comments on commit ed1c082

Please sign in to comment.