terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct

时间:2021-12-24 20:20:17

terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct NULL not valid

 

主要原因:string对一个空指针进行操作。

 

例如:char* p = NULL:

string str(p);              //运行时报错