Skip to content

Commit c8ebe55

Browse files
committed
Warning fix.
1 parent 1eefa2d commit c8ebe55

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/config/proto.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,7 @@ static ProtoField resolveProtoPath(
123123
item,
124124
index));
125125

126-
if (field->is_optional() || field->is_required())
127-
{
128-
if (!create && !reflection->HasField(*message, field))
129-
throw ProtoPathNotFoundException(fmt::format(
130-
"could not find config field '{}'", field->name()));
131-
message = reflection->MutableMessage(message, field);
132-
}
133-
else if (field->is_repeated())
126+
if (field->is_repeated())
134127
{
135128
if (index == -1)
136129
throw ProtoPathNotFoundException(fmt::format(
@@ -141,7 +134,12 @@ static ProtoField resolveProtoPath(
141134
message = reflection->MutableRepeatedMessage(message, field, index);
142135
}
143136
else
144-
error("bad proto label for field '{}' in '{}'", item, path);
137+
{
138+
if (!create && !reflection->HasField(*message, field))
139+
throw ProtoPathNotFoundException(fmt::format(
140+
"could not find config field '{}'", field->name()));
141+
message = reflection->MutableMessage(message, field);
142+
}
145143

146144
descriptor = message->GetDescriptor();
147145
}

0 commit comments

Comments
 (0)