From ea8627a4538a96dd6b0feadcfd8fe0157aa5c206 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 27 Mar 2020 10:34:45 -0400 Subject: [PATCH] Components: SlotFill: Guard property access to possibly-undefined slot --- .../src/slot-fill/bubbles-virtually/slot-fill-provider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/slot-fill/bubbles-virtually/slot-fill-provider.js b/packages/components/src/slot-fill/bubbles-virtually/slot-fill-provider.js index d487d98fbfa9a1..26b4a32c7c600c 100644 --- a/packages/components/src/slot-fill/bubbles-virtually/slot-fill-provider.js +++ b/packages/components/src/slot-fill/bubbles-virtually/slot-fill-provider.js @@ -29,7 +29,7 @@ function useSlotRegistry() { const { [ name ]: slot, ...nextSlots } = prevSlots; // Make sure we're not unregistering a slot registered by another element // See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412 - if ( slot.ref === ref ) { + if ( slot?.ref === ref ) { return nextSlots; } return prevSlots;