Skip to content

Commit

Permalink
fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
AmaliMatharaarachchi committed Sep 14, 2023
1 parent 193f7bd commit b92b648
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion adapter/internal/oasparser/model/http_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func (swagger *AdapterInternalAPI) SetInfoHTTPRouteCR(httpRoute *gwapiv1b1.HTTPR
resourceAPIPolicy = concatAPIPolicies(resourceAPIPolicy, nil)
resourceAuthScheme = concatAuthSchemes(resourceAuthScheme, nil)
resourceRatelimitPolicy = concatRateLimitPolicies(resourceRatelimitPolicy, nil)
loggers.LoggerAPI.Error(resourceRatelimitPolicy)
addOperationLevelInterceptors(&policies, resourceAPIPolicy, resourceParams.InterceptorServiceMapping, resourceParams.BackendMapping, httpRoute.Namespace)

loggers.LoggerOasparser.Debugf("Calculating auths for API ..., API_UUID = %v", swagger.UUID)
Expand Down Expand Up @@ -428,7 +429,7 @@ func getCorsConfigFromAPIPolicy(apiPolicy *dpv1alpha1.APIPolicy) *CorsConfig {

func parseRateLimitPolicyToInternal(ratelimitPolicy *dpv1alpha1.RateLimitPolicy) *RateLimitPolicy {
var rateLimitPolicyInternal *RateLimitPolicy
if ratelimitPolicy != nil {
if ratelimitPolicy != nil && ratelimitPolicy.Spec.Override != nil {
if ratelimitPolicy.Spec.Override.API.RequestsPerUnit > 0 {
rateLimitPolicyInternal = &RateLimitPolicy{
Count: ratelimitPolicy.Spec.Override.API.RequestsPerUnit,
Expand Down

0 comments on commit b92b648

Please sign in to comment.