Set Texture Parameter for a Landscape Material

I’m trying to update Texture parameter for a landscape material. This texture is generated programmatically (c++).

//at begin play
{
    // Get terrain
	UWorld* world = GetWorld();
	if (world == nullptr)
		return ;

	// Find the active landscape
	TActorIterator<ALandscape> landscapeIterator(world);
	ALandscape* landscape = *landscapeIterator;

	_landscapeMaterial = landscape->GetLandscapeMaterial();

	// Generate texture from tiff
	if (!_generateTextureFromTiff(FirstFileName, _myTexture))
		return;

	_landscapeMaterial->GetTextureParameterValue("MeraLsTexture", _oldTexture);
	_landscapeMaterial->OverrideTexture(_oldTexture, _myTexture, ERHIFeatureLevel::SM5);
      //...
}

This works for the first time I hit play but crashes the next time I run it.

am I doing something wrong here?

Thanks!