Fix StringRef self-assignment after substring

Thanks to Alex Tkachenko for spotting it.
This commit is contained in:
Phil Nash committed 2019-05-18 17:54:39 +01:00
1 parent e680c4b9fb
commit 3bce8ba14b
2 files changed
+11 -4

No files matched your search

+6 -4
View File
@@ -71,10 +71,12 @@ namespace Catch {
}
auto operator = ( StringRef const &other ) noexcept -> StringRef& {
delete[] m_data;
m_data = nullptr;
m_start = other.m_start;
m_size = other.m_size;
if( this != &other ) {
delete[] m_data;
m_data = nullptr;
m_start = other.m_start;
m_size = other.m_size;
}
return *this;
}