How to Avoid the Error: Terminate Called After Throwing an Instance of 'Std: :Logic_Error' What(): Basic_String: :_S_Construct Null Not Valid

How to Avoid the Error: Terminate Called After Throwing an Instance of 'Std: :Logic_Error' What(): Basic_String: :_S_Construct Null Not Valid
if(player!=NULL)
    player->shuffled();

I do such things to avoid passing a null reference to a string constructor, but when compiling it still comes to error.

3

1 Answer

Somewhere, somehow, you're calling the std::string constructor with the const char* value NULL.

To avoid the problem. Don't do that.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.