Skip to content

Commit

Permalink
Produce error if nullptr is provided for CCDB upload
Browse files Browse the repository at this point in the history
  • Loading branch information
shahor02 committed Dec 8, 2023
1 parent 61c66c1 commit 5d48894
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CCDB/src/CcdbApi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ int CcdbApi::storeAsTFile_impl(const void* obj, std::type_info const& tinfo, std
std::vector<char>::size_type maxSize) const
{
// We need the TClass for this type; will verify if dictionary exists
if (!obj) {
LOGP(error, "nullptr is provided for object {}/{}/{}", path, startValidityTimestamp, endValidityTimestamp);
return -1;
}
CcdbObjectInfo info;
auto img = createObjectImage(obj, tinfo, &info);
return storeAsBinaryFile(img->data(), img->size(), info.getFileName(), info.getObjectType(),
Expand Down Expand Up @@ -376,6 +380,10 @@ int CcdbApi::storeAsTFile(const TObject* rootObject, std::string const& path, st
long startValidityTimestamp, long endValidityTimestamp, std::vector<char>::size_type maxSize) const
{
// Prepare file
if (!rootObject) {
LOGP(error, "nullptr is provided for object {}/{}/{}", path, startValidityTimestamp, endValidityTimestamp);
return -1;
}
CcdbObjectInfo info;
auto img = createObjectImage(rootObject, &info);
return storeAsBinaryFile(img->data(), img->size(), info.getFileName(), info.getObjectType(), path, metadata, startValidityTimestamp, endValidityTimestamp, maxSize);
Expand Down

0 comments on commit 5d48894

Please sign in to comment.