I did some more debugging and im running into an error at this section of my code. This is the error i got, im not sure why. I think it might be because im not storing the values to the dynamic memory properly.
I used the lldb debugger and its saying my segmentation fault is occuring on this line, not sure why. I thought by check to see if the value is not a nullptr then i can continue to deallocate the dynamic memory