summaryrefslogtreecommitdiffstats
path: root/src/kwsys/EncodingCXX.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/kwsys/EncodingCXX.cxx')
-rw-r--r--src/kwsys/EncodingCXX.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/kwsys/EncodingCXX.cxx b/src/kwsys/EncodingCXX.cxx
index f76deb5..251a56d 100644
--- a/src/kwsys/EncodingCXX.cxx
+++ b/src/kwsys/EncodingCXX.cxx
@@ -110,16 +110,19 @@ Encoding::CommandLineArguments::
Encoding::CommandLineArguments&
Encoding::CommandLineArguments::operator=(const CommandLineArguments& other)
{
- size_t i;
- for(i=0; i<this->argv_.size(); i++)
+ if(this != &other)
{
- free(this->argv_[i]);
- }
+ size_t i;
+ for(i=0; i<this->argv_.size(); i++)
+ {
+ free(this->argv_[i]);
+ }
- this->argv_.resize(other.argv_.size());
- for(i=0; i<this->argv_.size(); i++)
- {
- this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ this->argv_.resize(other.argv_.size());
+ for(i=0; i<this->argv_.size(); i++)
+ {
+ this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ }
}
return *this;