grpc-js-xds: Add null checks to handle generated code changes

This commit is contained in:
Michael Lumish 2021-08-03 15:06:47 -07:00
parent 365b379193
commit f216ecef00
2 changed files with 2 additions and 2 deletions

View File

@ -228,7 +228,7 @@ class XdsResolver implements Resolver {
onValidUpdate: (update: Listener__Output) => {
const httpConnectionManager = decodeSingleResource(HTTP_CONNECTION_MANGER_TYPE_URL_V3, update.api_listener!.api_listener!.value);
const defaultTimeout = httpConnectionManager.common_http_protocol_options?.idle_timeout;
if (defaultTimeout === undefined) {
if (defaultTimeout === null || defaultTimeout === undefined) {
this.latestDefaultTimeout = undefined;
} else {
this.latestDefaultTimeout = protoDurationToDuration(defaultTimeout);

View File

@ -137,7 +137,7 @@ export class RdsState implements XdsStreamState<RouteConfiguration__Output> {
if (route.action !== 'route') {
return false;
}
if ((route.route === undefined) || SUPPORTED_CLUSTER_SPECIFIERS.indexOf(route.route.cluster_specifier) < 0) {
if ((route.route === undefined) || (route.route === null) || SUPPORTED_CLUSTER_SPECIFIERS.indexOf(route.route.cluster_specifier) < 0) {
return false;
}
if (EXPERIMENTAL_FAULT_INJECTION) {