aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bufferstore.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bufferstore.cc')
-rw-r--r--lib/bufferstore.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/bufferstore.cc b/lib/bufferstore.cc
index 8d7ed45..183ae6c 100644
--- a/lib/bufferstore.cc
+++ b/lib/bufferstore.cc
@@ -55,10 +55,12 @@ bufferStore::bufferStore(const unsigned char *_buff, long _len) {
}
bufferStore &bufferStore::operator =(const bufferStore &a) {
- checkAllocd(a.getLen());
- len = a.getLen();
- memcpy(buff, a.getString(0), len);
- start = 0;
+ if (this != &a) {
+ checkAllocd(a.getLen());
+ len = a.getLen();
+ memcpy(buff, a.getString(0), len);
+ start = 0;
+ }
return *this;
}