HttpHeaders: Check assigning self in operator=()

This commit is contained in:
Stephan Aßmus
2014-06-06 00:23:46 +02:00
parent 7a214200ed
commit 79852c5551
+4 -1
View File
@@ -102,7 +102,7 @@ BHttpResult::StatusText() const
bool bool
BHttpResult::HasHeaders() const BHttpResult::HasHeaders() const
{ {
return (fHeaders.CountHeaders() > 0); return fHeaders.CountHeaders() > 0;
} }
@@ -112,6 +112,9 @@ BHttpResult::HasHeaders() const
BHttpResult& BHttpResult&
BHttpResult::operator=(const BHttpResult& other) BHttpResult::operator=(const BHttpResult& other)
{ {
if (this == &other)
return *this;
fUrl = other.fUrl; fUrl = other.fUrl;
fHeaders = other.fHeaders; fHeaders = other.fHeaders;
fStatusCode = other.fStatusCode; fStatusCode = other.fStatusCode;