X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcollection.h;h=b2239905edb4d824cd14e1d763ff62d234672032;hb=61f6f66a7db1a074143cd0e9948a262d30876dea;hp=021b714a934e05dbb190dd4b2b473f1607b160e6;hpb=4931b4867258d1d2c20bad7ec24dfe4b99646aa1;p=libs%2Fdatafile.git diff --git a/source/collection.h b/source/collection.h index 021b714..b223990 100644 --- a/source/collection.h +++ b/source/collection.h @@ -58,7 +58,7 @@ public: template void coll_item(const std::string &n) { - RefPtr it=new T; + RefPtr it = new T; load_sub(*it, dynamic_cast(coll)); coll.add(n, it.get()); it.release(); @@ -67,13 +67,11 @@ public: template void item(const std::string &n) { - RefPtr it=new T; + RefPtr it = new T; load_sub(*it); coll.add(n, it.get()); it.release(); } - - template friend class ItemKeyword; }; private: @@ -341,7 +339,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); } };