diff --git a/examples/datamap.hh b/examples/datamap.hh
index f3c2c157298e1c7651ee8df4970fbaa242dae292..26274a7977123f41a781751fcfad3d5d7b79f8c0 100644
--- a/examples/datamap.hh
+++ b/examples/datamap.hh
@@ -69,10 +69,12 @@ public:
   {
     assert( n == size( entity ) );
 
-    data_.resize();
     // we only have data on the leaf level
     if( entity.isLeaf() )
+    {
+      data_.resize();
       buffer.read( data_[ entity ] );
+    }
   }
 
   //! see documentation in Dune::CommDataHandleIF (method for general entities)