Explorar el Código

check nil settings

Darien Raymond hace 9 años
padre
commit
f87d7f36f5
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      proxy/registry/config_cache.go

+ 6 - 0
proxy/registry/config_cache.go

@@ -26,6 +26,9 @@ func MarshalInboundConfig(protocol string, settings *any.Any) (interface{}, erro
 	if err != nil {
 		return nil, err
 	}
+	if settings == nil {
+		return config, nil
+	}
 	if err := ptypes.UnmarshalAny(settings, config.(proto.Message)); err != nil {
 		return nil, err
 	}
@@ -37,6 +40,9 @@ func MarshalOutboundConfig(protocol string, settings *any.Any) (interface{}, err
 	if err != nil {
 		return nil, err
 	}
+	if settings == nil {
+		return config, nil
+	}
 	if err := ptypes.UnmarshalAny(settings, config.(proto.Message)); err != nil {
 		return nil, err
 	}