Editor freezes then crashes on Draw2DLines

The code just compiles fine but when the Draw2DLine should execute the editor freezes for 30-40 seconds and then crashes (crash log : Assertion failed: Canvas [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\ - Pastebin.com).
I guess i am missing some files to include or encapsule the function with some block maybe, but on the documentation page i couldn’t find anything that indicates such thing

The function is called from the hud which is performed a cast on by the player controller

This is my code, here the
cast from the player controller

AMyHUD * hud = Cast<AMyHUD>(this->GetHUD());
	hud->DrawLine(StartPosition,EndPosition);

and this is the function where Draw2DLine is called in the hud class

void AMyHUD::DrawLine(FVector2D start,FVector2D end) {
	Draw2DLine(start.X,start.Y,end.X,end.Y, FColor::Red);
}

It’s not called in the constructor and the variables i use as parameter are public. I also tried to give the Draw2DLine specific coordinates and not using variables at all but it still crashes.

If i remove the Draw2DLine from the function it just get called fine with no crashes.