Skip to content
Snippets Groups Projects
Commit 98552767 authored by Oliver Sander's avatar Oliver Sander
Browse files

Fix copy construction and assignment from a null pointer.

This fixes FS 864.

[[Imported from SVN: r6322]]
parent 3afb9c91
No related branches found
No related tags found
No related merge requests found
......@@ -214,14 +214,17 @@ namespace Dune
template<class T>
inline shared_ptr<T>::shared_ptr(const shared_ptr<T>& other) : rep_(other.rep_)
{
++(rep_->count_);
if (rep_)
++(rep_->count_);
}
template<class T>
inline shared_ptr<T>& shared_ptr<T>::operator=(const shared_ptr<T>& other)
{
(other.rep_->count_)++;
if(rep_!=0 && --(rep_->count_)<=0) delete rep_;
if (other.rep_) {
(other.rep_->count_)++;
if(rep_!=0 && --(rep_->count_)<=0) delete rep_;
}
rep_ = other.rep_;
return *this;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment