phrocker commented on a change in pull request #499: MINIFICPP-748 - Nanofi: 
add custom C processor example
URL: https://github.com/apache/nifi-minifi-cpp/pull/499#discussion_r263540555
 
 

 ##########
 File path: nanofi/src/api/nanofi.cpp
 ##########
 @@ -371,9 +371,18 @@ int8_t remove_attribute(flow_file_record *ff, const char 
*key) {
 int get_content(const flow_file_record* ff, uint8_t* target, int size) {
   NULL_CHECK(0, ff, target);
   auto content_repo = 
static_cast<std::shared_ptr<minifi::core::ContentRepository>*>(ff->crp);
-  std::shared_ptr<minifi::ResourceClaim> claim = 
std::make_shared<minifi::ResourceClaim>(ff->contentLocation, *content_repo);
-  auto stream = (*content_repo)->read(claim);
-  return stream->read(target, size);
+  if(ff->crp && (*content_repo)) {
+    std::shared_ptr<minifi::ResourceClaim> claim = 
std::make_shared<minifi::ResourceClaim>(ff->contentLocation,
+                                                                               
            *content_repo);
+    auto stream = (*content_repo)->read(claim);
+    return stream->read(target, size);
+  } else {
 
 Review comment:
   Imagine if there were no c++ involved, and as a result, no content repo, 
would that change your concern? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to