mirror of https://github.com/grpc/grpc-node.git
Prevent early return in proto-loader containsDefinition
f289c343b3
introduced a bug - the
recursive for-loop descended into the first elements nested array
and returned that value without iterating over the other members
of the array. This means that the code would only work correctly
when the protofile contained a definition whose name was alphabetically
first amongst its siblings.
This commit fixes the issue by moving the call to containsDefinition
into the if statement to allow iteration to continue if
containsDefinition returns false.
This commit is contained in:
parent
f87744b917
commit
41e09f7d12
|
@ -583,8 +583,8 @@ function containsDefinition(definitionType: typeof Protobuf.Type | typeof Protob
|
|||
for (const nested of namespace.nestedArray.sort(compareName)) {
|
||||
if (nested instanceof definitionType) {
|
||||
return true;
|
||||
} else if (isNamespaceBase(nested) && !(nested instanceof Protobuf.Type) && !(nested instanceof Protobuf.Enum)) {
|
||||
return containsDefinition(definitionType, nested);
|
||||
} else if (isNamespaceBase(nested) && !(nested instanceof Protobuf.Type) && !(nested instanceof Protobuf.Enum) && containsDefinition(definitionType, nested)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue