diff options
Diffstat (limited to 'document')
-rw-r--r-- | document/src/vespa/document/update/valueupdate.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/document/src/vespa/document/update/valueupdate.cpp b/document/src/vespa/document/update/valueupdate.cpp index 103d9341f0e..b43f9f7f095 100644 --- a/document/src/vespa/document/update/valueupdate.cpp +++ b/document/src/vespa/document/update/valueupdate.cpp @@ -13,20 +13,18 @@ IMPLEMENT_IDENTIFIABLE_ABSTRACT(ValueUpdate, Identifiable); std::unique_ptr<ValueUpdate> ValueUpdate::createInstance(const DocumentTypeRepo& repo, const DataType& type, ByteBuffer& buffer, int serializationVersion) { - ValueUpdate* update(NULL); int32_t classId = 0; buffer.getIntNetwork(classId); const Identifiable::RuntimeClass * rtc(Identifiable::classFromId(classId)); - if (rtc != NULL) { - update = static_cast<ValueUpdate*>(Identifiable::classFromId(classId)->create()); - /// \todo TODO (was warning): Updates are not versioned in serialization format. Will not work with altering it. + if (rtc != nullptr) { + std::unique_ptr<ValueUpdate> update(static_cast<ValueUpdate*>(rtc->create())); + /// \todo TODO (was warning): Updates are not versioned in serialization format. Will not work without altering it. update->deserialize(repo, type, buffer, serializationVersion); + return update; } else { throw std::runtime_error(vespalib::make_string("Could not find a class for classId %d(%x)", classId, classId)); } - - return std::unique_ptr<ValueUpdate>(update); } } |