X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Ffs%2Fstat.cpp;h=e296ead3816b9317ecd44f0bc82bf6fbd12cbbed;hp=ae9f803a9d16f1030da32d1c9e63f14cf7b48356;hb=HEAD;hpb=122846f0881673770d88eff7d925ecf25c01b62e diff --git a/source/fs/stat.cpp b/source/fs/stat.cpp index ae9f803..e296ead 100644 --- a/source/fs/stat.cpp +++ b/source/fs/stat.cpp @@ -14,11 +14,14 @@ Stat::Stat(const Stat &other): alloc_size(other.alloc_size), mtime(other.mtime), owner_info(other.owner_info), - priv(other.priv ? new Private(*other.priv) : 0) + priv(other.priv ? new Private(*other.priv) : nullptr) { } Stat &Stat::operator=(const Stat &other) { + if(&other==this) + return *this; + exists = other.exists; type = other.type; size = other.size; @@ -26,7 +29,7 @@ Stat &Stat::operator=(const Stat &other) mtime = other.mtime; owner_info = other.owner_info; delete priv; - priv = (other.priv ? new Private(*other.priv) : 0); + priv = (other.priv ? new Private(*other.priv) : nullptr); return *this; }