NoMethodError in Web#web_subcategory

Showing /var/www/vhosts/shopmultimarca.es/shopmultimarca/app/views/web/web_subcategory.html.erb where line #32 raised:

undefined method `category' for nil:NilClass

Extracted source (around line #32):

29
30
31
32
33
34
35
          
<% end %>
<% end %>
],
item_list_id: <%= @products.first.category.id %>,
item_list_name: "<%= @products.first.category.name %>",
currency: "EUR",
},

Rails.root: /var/www/vhosts/shopmultimarca.es/shopmultimarca

Application Trace | Framework Trace | Full Trace
app/views/web/web_subcategory.html.erb:32:in `_app_views_web_web_subcategory_html_erb___168982242954332707_47022196281280'

Request

Parameters:

{"brand"=>"LEVIĀ“S",
 "id"=>"20-sudaderas-hombre"}

Response

Headers:

None