summaryrefslogtreecommitdiff
path: root/i18nlangtag
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-09-20 13:36:33 +0200
committerEike Rathke <erack@redhat.com>2013-09-20 18:31:04 +0200
commite3a01c2b0c00a502622f3b6f0be560cf32b3b774 (patch)
tree661c8ed9a34e9e5552245c5250134663a1339e43 /i18nlangtag
parent862766d569e51d91c11139cc831fb083c8bbdd01 (diff)
check for identity in operator=()
Change-Id: I687dc4bdd3093054a6e2c1fd383cfc2a8c948303
Diffstat (limited to 'i18nlangtag')
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 315463974cb8..f1f05d8d83a4 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -383,6 +383,9 @@ LanguageTagImpl::LanguageTagImpl( const LanguageTagImpl & rLanguageTagImpl )
LanguageTagImpl& LanguageTagImpl::operator=( const LanguageTagImpl & rLanguageTagImpl )
{
+ if (&rLanguageTagImpl == this)
+ return *this;
+
maLocale = rLanguageTagImpl.maLocale;
maBcp47 = rLanguageTagImpl.maBcp47;
maCachedLanguage = rLanguageTagImpl.maCachedLanguage;
@@ -534,6 +537,9 @@ LanguageTag::LanguageTag( const LanguageTag & rLanguageTag )
LanguageTag& LanguageTag::operator=( const LanguageTag & rLanguageTag )
{
+ if (&rLanguageTag == this)
+ return *this;
+
maLocale = rLanguageTag.maLocale;
maBcp47 = rLanguageTag.maBcp47;
mnLangID = rLanguageTag.mnLangID;