How to set the widget class to none in c++

I managed to solve it the problem was in the character class I was calling the enable widget function when the pawn I was casting to was set to nullptr.