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

北战南征 提交于 2019-11-29 00:27:44

问题


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.


回答1:


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

To avoid the problem. Don't do that.



来源:https://stackoverflow.com/questions/11705886/how-to-avoid-the-error-terminate-called-after-throwing-an-instance-of-stdlog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!