Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid the error: terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid

Tags:

c++

libstdc++

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.

like image 238
Czon Avatar asked Jul 29 '12 01:07

Czon


1 Answers

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

To avoid the problem. Don't do that.

like image 193
Dave S Avatar answered Oct 23 '22 03:10

Dave S