]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/collection.h
Add DirectoryCollection class for creating directory-backed collections
[libs/datafile.git] / source / collection.h
index 8b4eba01b0fb5b83f4a1fdc936d6d327ba4bc971..91f8f070cefbfabe0e0f5a878743fd9eb4e38f00 100644 (file)
@@ -46,7 +46,7 @@ public:
                template<typename T> friend class CollectionItemType;
 
        private:
-               template<typename T, typename S, bool = NeedsCollection<T>::value >
+               template<typename T, typename S, bool = NeedsCollection<typename T::Loader>::value>
                struct Add;
 
                Collection &coll;
@@ -341,7 +341,8 @@ public:
                if(!creat)
                        throw std::runtime_error("no creator");
                T *obj = creat->create(coll, name);
-               store->store(coll, name, obj);
+               if(obj)
+                       store->store(coll, name, obj);
        }
 };