diff --git a/src/api/processor/object.h b/src/api/processor/object.h index 8f43829..808b150 100644 --- a/src/api/processor/object.h +++ b/src/api/processor/object.h @@ -31,6 +31,7 @@ struct MYNTEYE_API Object { virtual ~Object() = default; virtual Object *Clone() const = 0; + virtual bool DecValidity() const = 0; /** Cast the obj to T pointer */ template @@ -65,6 +66,10 @@ struct MYNTEYE_API ObjMat : public Object { mat->value = value.clone(); return mat; } + + bool DecValidity() const { + return !value.empty(); + } }; /** @@ -87,6 +92,10 @@ struct MYNTEYE_API ObjMat2 : public Object { mat2->second = second.clone(); return mat2; } + + bool DecValidity() const { + return !first.empty() && !second.empty(); + } }; MYNTEYE_END_NAMESPACE diff --git a/src/api/processor/processor.cc b/src/api/processor/processor.cc index 851b464..067cfe3 100644 --- a/src/api/processor/processor.cc +++ b/src/api/processor/processor.cc @@ -130,6 +130,10 @@ bool Processor::Process(const Object &in) { return false; } } + if (!in.DecValidity()){ + LOG(WARNING) << "Input is invalid"; + return false; + } { std::lock_guard lk(mtx_input_ready_); input_.reset(in.Clone());