The signature for UPrimitiveComponent::SetMaterial takes a pointer parameter for the material, not a value. Try providing nullptr instead of NULL and see if that works.
That’s very strange that it worked for the OP. nullptr is just value 0 and is implicitly casted to any pointer type. 0 or NULL is just a integer literal. The code generated from calling SetMaterial(1, 0), SetMaterial(1,NULL) and SetMaterial(1,nullptr) is exactly the same: on x64 Windows it’ll push pointer to the object on which you call it to rcx register, then the first parameter 1 into rdx register and then 0 into an r8 register in all 3 cases of the code.