Assert in UE4 4.5.0 with DrawMaterialSimple()

I’m getting an assert (callstack available below) in my current UE4 project because of the function DrawMaterialSimple() in my HUD class.

Setup in the constructor :

	//===================================================
	//Pause
	//---------------------------------------------------	
	static ConstructorHelpers::FObjectFinder<UMaterialInterface> shPauseFont(TEXT("Material'/Game/HUD/Mat/sh_paused_font.sh_paused_font'"));
	PausedTextMaterial = UMaterialInstanceDynamic::Create( shPauseFont.Object, this );

Call to the function :

void AExilHud::DrawGlobal()	
{
	float x = Canvas->ClipX / 2;
	float y = Canvas->ClipY / 2;

	if( EC->EPC->IsPaused() && !EC->EPC->IsFreeCamEnabled() && PausedTextMaterial != NULL )
	{
		DrawMaterialSimple(PausedTextMaterial, x - 64, (y * 2) - 64, 256, 128, 0.5f, false);
	}
}

Any ideas how I can fix that ? I’m using a custom GitHub build of the engine. However I didn’t change anything related to the Canvas/HUD in the original source code of the version 4.5.0.

The assert seems to come from the FCanvasTileItem() function :

FCanvasTileItem::FCanvasTileItem(const FVector2D& InPosition, const FMaterialRenderProxy* InMaterialRenderProxy, const FVector2D& InSize)
	: FCanvasItem(InPosition)
	, Size(InSize)
	, Z(1.0f)
	, UV0(0.0f, 0.0f)
	, UV1(1.0f, 1.0f)
	, Texture(NULL)
	, MaterialRenderProxy(InMaterialRenderProxy)
	, Rotation(ForceInitToZero)
	, PivotPoint(FVector2D::ZeroVector)
{
	// Ensure specify Texture or material, but not both.
	check(InMaterialRenderProxy);
}

Here is the callstack :

[2015.02.14-02.02.13:187][849]LogWindows: === Critical error: ===
Fatal error!

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xffffffff

UE4Editor-Engine.dll!AHUD::DrawMaterialSimple() (0x000007fecb8e205a) + 79 bytes [c:\github\unrealengine\engine\source\runtime\engine\private\hud.cpp:595]
UE4Editor-Exil.dll!AExilHud::DrawGlobal() (0x000007fec4c25305) + 0 bytes [v:\ue4projects\exil\source\exil\exilhud.cpp:482]
UE4Editor-Exil.dll!AExilHud::DrawHUD() (0x000007fec4c2537b) + 0 bytes [v:\ue4projects\exil\source\exil\exilhud.cpp:434]
UE4Editor-Engine.dll!AHUD::PostRender() (0x000007fecb910fe1) + 0 bytes [c:\github\unrealengine\engine\source\runtime\engine\private\hud.cpp:137]
UE4Editor-Engine.dll!UGameViewportClient::Draw() (0x000007fecb85091e) + 0 bytes [c:\github\unrealengine\engine\source\runtime\engine\private\gameviewportclient.cpp:994]
UE4Editor-Engine.dll!FViewport::Draw() (0x000007fecbd51099) + 0 bytes [c:\github\unrealengine\engine\source\runtime\engine\private\unrealclient.cpp:1081]
UE4Editor-Engine.dll!UGameEngine::RedrawViewports() (0x000007fecb87a745) + 9 bytes [c:\github\unrealengine\engine\source\runtime\engine\private\gameengine.cpp:360]
UE4Editor-Engine.dll!UGameEngine::Tick() (0x000007fecb88b7db) + 0 bytes [c:\github\unrealengine\engine\source\runtime\engine\private\gameengine.cpp:917]
UE4Editor-Cmd.exe!FEngineLoop::Tick() (0x000000013f07b224) + 0 bytes [c:\github\unrealengine\engine\source\runtime\launch\private\launchengineloop.cpp:2129]
UE4Editor-Cmd.exe!GuardedMain() (0x000000013f070c3e) + 0 bytes [c:\github\unrealengine\engine\source\runtime\launch\private\launch.cpp:133]
UE4Editor-Cmd.exe!GuardedMainWrapper() (0x000000013f070caa) + 5 bytes [c:\github\unrealengine\engine\source\runtime\launch\private\windows\launchwindows.cpp:125]
UE4Editor-Cmd.exe!WinMain() (0x000000013f07c859) + 17 bytes [c:\github\unrealengine\engine\source\runtime\launch\private\windows\launchwindows.cpp:201]
UE4Editor-Cmd.exe!__tmainCRTStartup() (0x000000013f07d33d) + 21 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
kernel32.dll!UnknownFunction (0x0000000076eb652d) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x0000000076fec521) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x0000000076fec521) + 0 bytes [UnknownFile:0]

Just to precise : the instanced material seems to work fine as I’m able to see the shader in-game. I don’t always draw it, only when I open an in-game menu. So I often toggle between drawing and not drawing the shader. The assert seems random but happens often.

I encountered the same problem, but I’m using 4.7.4.