Editor crashes after updating code as recommended by compiler warning C4996 UnbindRenderTargets API is deprecated

UE4 is crashing when I try to run my game with the changes recommended by the compiler. UE4 will then crash when trying to open my project again until I change my code back to what it was originally.

The compiler outputs warning C4996: ‘UnbindRenderTargets’: UnbindRenderTargets API is deprecated; EndRenderPass implies UnbindRenderTargets. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.

I have changed the line in question as recommended :

UnbindRenderTargets(RHICmdList);

to :

RHICmdList.EndRenderPass();

What am I missing here ?