[lldb-mi] Fix assignment operator in CMIUtilString

Fix assignment operator in CMIUtilString to not crash the debugger if it
is passed a NULL pointer, which can happen in code like the following:

    SBValue val;
    CMIUtilString s;
    //...
    s = val.GetSummary();

Patch from evgeny.leviant@gmail.com
Reviewed by: clayborg, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13094

llvm-svn: 248597
This commit is contained in:
Dawn Perchik 2015-09-25 18:08:45 +00:00
parent 8e3a7ede94
commit a556fe8ec3
1 changed files with 1 additions and 8 deletions

View File

@ -63,14 +63,7 @@ CMIUtilString::CMIUtilString(const std::string& vrStr)
//--
CMIUtilString &CMIUtilString::operator=(const char *vpRhs)
{
if (*this == vpRhs)
return *this;
if (vpRhs != nullptr)
{
assign(vpRhs);
}
assign(vpRhs);
return *this;
}