From 5f12741f4a1a273b719e6f940fe892a2a294ee74 Mon Sep 17 00:00:00 2001 From: Ruben Izmailyan Date: Tue, 22 Mar 2022 08:31:10 -0500 Subject: [PATCH] Fix `NoMethodError` When `country_codes` is nil, the `list_invalid_properties` method will error with a NoMethodError since you cannot call `#length` on `nil`. ``` request = ::Plaid::LinkTokenCreateRequest.new(products: ['transactions']) request.valid? # false request.list_invalid_properties # NoMethodError: undefined method `length' for nil:NilClass ``` --- lib/plaid/models/link_token_create_request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plaid/models/link_token_create_request.rb b/lib/plaid/models/link_token_create_request.rb index e51d1464a..7f241c7b4 100644 --- a/lib/plaid/models/link_token_create_request.rb +++ b/lib/plaid/models/link_token_create_request.rb @@ -265,7 +265,7 @@ def list_invalid_properties end - if @country_codes.length < 1 + if @country_codes && @country_codes.length < 1 invalid_properties.push('invalid value for "country_codes", number of items must be greater than or equal to 1.') end