SPropertyMenuComponentPicker crashes depending on clipboard contents

The component picker has a Paste option and when trying to decide if it should be enabled or not it attempts to load a class using the clipboard contents as a class name. If this contains a double slash the loader hits a Fatal error.

It’s kind of random, it just depends if your clipboard happens to have two things separated by a space and the first of them contains a double slash. When I found this I’d just copied some code comments so the clipboard contained

// some comment

Steps to Reproduce
Choose any class containing properties that use the component picker. I chose the ChaosCacheManager which has an array of FObservedComponent with

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = “Caching”, meta = (UseComponentPicker, AllowAnyActor))

Create an empty level

Drag a ChaosCacheManager into the level

Click ‘+’ on its ObservedComponents to add an empty entry

Expand the entry

Click on the component picker shown for ‘Soft Component Ref’

It should open as expected

In Notepad (or similar) type the following:

class// path

Copy that text to the clipboard

Return to the editor and click on the component picker again. This time it should crash with a Fatal error because of the “//” in what it thinks is a class name.