[Svace] Add missing model existence checking
authorDongju Chae <dongju.chae@samsung.com>
Tue, 6 Jul 2021 03:12:42 +0000 (12:12 +0900)
committer채동주/On-Device Lab(SR)/Staff Engineer/삼성전자 <dongju.chae@samsung.com>
Tue, 6 Jul 2021 06:42:53 +0000 (15:42 +0900)
This patch adds missing model existence checking.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
src/core/ne-handler.cc

index 21e227e737fc62ae53723f601fbb56c36c9ff89a..dea9024556412c39d1c4e54475ce87728273e9d9 100644 (file)
@@ -1095,7 +1095,9 @@ TrinityVision2::callback (Request *req, npuOutputNotify cb, void *cb_data) {
 
   const Model *model = req->getModel ();
   SegmentTable *segt = dynamic_cast<SegmentTable *> (req->getInferData ());
+
   /** internal logic error */
+  assert (model != nullptr);
   assert (segt != nullptr);
 
   output_buffers *output = req->getOutputBuffers ();
@@ -1396,6 +1398,11 @@ TrinityVision2::submitRequestKernel (int req_id) {
   }
 
   const Model *model = req->getModel ();
+  if (model == nullptr) {
+    logerr (TAG, "Unable to find the model associated to this request\n");
+    return -ENOENT;
+  }
+
   SegmentTable *segt = dynamic_cast<SegmentTable *> (req->getInferData ());
   if (segt != nullptr) {
     logwarn (TAG, "Segment table with user-provided data is destroyed\n");