mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Fix StringRef self-assignment after substring
Thanks to Alex Tkachenko for spotting it.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user