Bug report: button->GetSize() crash when are inside a panel

Hello unreal poeple, reporting a little bit issue, this is my function

FBoundaries UMyStuffAndUtils::getBoundaries(UButton* button)
{
	FBoundaries bounds;
	
	UCanvasPanelSlot* buttonSlot = Cast<UCanvasPanelSlot>(button->Slot);
	FVector2D point = buttonSlot->GetPosition();
	FVector2D resolution = buttonSlot->GetSize(); // here is the problem
    //bla bla bla more function
}

When i get button size all is ok, but if this button is inside some canvas with autoajust this crash in c++, if doing on blueprints just send me a error report in log, but not crash. Not a big deal, but is annoying jaja.

Greetings!!!