Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

FIX avoid authorize on nil object (#13121)

brozek02a61a86c3c7
diff --git a/admin/app/controllers/spree/admin/resource_controller.rb b/admin/app/controllers/spree/admin/resource_controller.rb
index a5e4ccaad5..8ef1f5f2e3 100644
--- a/admin/app/controllers/spree/admin/resource_controller.rb
+++ b/admin/app/controllers/spree/admin/resource_controller.rb
@@ -154,7 +154,7 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
# call authorize! a third time (called twice already in Admin::BaseController)
# this time we pass the actual instance so fine-grained abilities can control
# access to individual records, not just entire models.
- authorize! action, @object
+ authorize! action, @object if @object.present?
instance_variable_set("@#{resource.object_name}", @object)
else