diff --git a/src/TNL/Pointers/SharedPointerCuda.h b/src/TNL/Pointers/SharedPointerCuda.h
index 7fdb4976f642adc94f7382c022da0410da1eb5d7..bdb938a9a13d15c34f590e8fd3d0264e67316356 100644
--- a/src/TNL/Pointers/SharedPointerCuda.h
+++ b/src/TNL/Pointers/SharedPointerCuda.h
@@ -191,7 +191,8 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer
       {
          this->free();
          this->pd = (PointerData*) ptr.pd;
-         this->pd->counter += 1;
+         if( this->pd != nullptr ) 
+            this->pd->counter += 1;
          return *this;
       }
 
@@ -202,7 +203,8 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer
       {
          this->free();
          this->pd = (PointerData*) ptr.pd;
-         this->pd->counter += 1;
+         if( this->pd != nullptr ) 
+            this->pd->counter += 1;
          return *this;
       }
 
diff --git a/src/TNL/Pointers/SharedPointerHost.h b/src/TNL/Pointers/SharedPointerHost.h
index fd4dd0ba0f9ebf537e265ff45a2eb540371df9f9..a91174aa4abdac338640436f0e9e11e5a54bdfd9 100644
--- a/src/TNL/Pointers/SharedPointerHost.h
+++ b/src/TNL/Pointers/SharedPointerHost.h
@@ -163,7 +163,8 @@ class SharedPointer<  Object, Devices::Host > : public SmartPointer
       {
          this->free();
          this->pd = (PointerData*) ptr.pd;
-         this->pd->counter += 1;
+         if( this->pd != nullptr )
+            this->pd->counter += 1;
          return *this;
       }
 
@@ -174,7 +175,8 @@ class SharedPointer<  Object, Devices::Host > : public SmartPointer
       {
          this->free();
          this->pd = (PointerData*) ptr.pd;
-         this->pd->counter += 1;
+         if( this->pd != nullptr )
+            this->pd->counter += 1;
          return *this;
       }
 
diff --git a/src/TNL/Pointers/SharedPointerMic.h b/src/TNL/Pointers/SharedPointerMic.h
index 65beab417c473dfcfb0d3dd0aa1fdcdce6c4f86a..7d578c8d6e1239cd6fc31d2a50ad452631d31746 100644
--- a/src/TNL/Pointers/SharedPointerMic.h
+++ b/src/TNL/Pointers/SharedPointerMic.h
@@ -186,7 +186,8 @@ class SharedPointer< Object, Devices::MIC > : public SmartPointer
          this->free();
          this->pd = (PointerData*) ptr.pd;
          this->mic_pointer = ptr.mic_pointer;
-         this->pd->counter += 1;
+         if( this->pd != nullptr )
+            this->pd->counter += 1;
 #ifdef TNL_DEBUG_SHARED_POINTERS
          std::cerr << "Copy-assigned shared pointer: counter = " << this->pd->counter << ", type: " << demangle(typeid(ObjectType).name()) << std::endl;
 #endif
@@ -201,7 +202,8 @@ class SharedPointer< Object, Devices::MIC > : public SmartPointer
          this->free();
          this->pd = (PointerData*) ptr.pd;
          this->mic_pointer = ptr.mic_pointer;
-         this->pd->counter += 1;
+         if( this->pd != nullptr )
+            this->pd->counter += 1;
 #ifdef TNL_DEBUG_SHARED_POINTERS
          std::cerr << "Copy-assigned shared pointer: counter = " << this->pd->counter << ", type: " << demangle(typeid(ObjectType).name()) << std::endl;
 #endif