How to avoid the error: terminate called after throwing an instance of ‘std::logic_error’ what(): basic_string::_S_construct null not valid
Somewhere, somehow, you’re calling the std::string constructor with the const char* value NULL. To avoid the problem. Don’t do that.