From 5d489294edd528cb2ab2acd3fd0f437e02d6c94b Mon Sep 17 00:00:00 2001
From: Sebastian Hahta <joseha@utu.fi>
Date: Mon, 27 May 2019 10:52:19 +0300
Subject: [PATCH] Added error message to undistort()

---
 components/rgbd-sources/src/calibrate.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/components/rgbd-sources/src/calibrate.cpp b/components/rgbd-sources/src/calibrate.cpp
index e72314bea..e1b1512d6 100644
--- a/components/rgbd-sources/src/calibrate.cpp
+++ b/components/rgbd-sources/src/calibrate.cpp
@@ -495,7 +495,10 @@ bool Calibrate::_recalibrate(vector<vector<Point2f>> *imagePoints,
 bool Calibrate::undistort(cv::Mat &l, cv::Mat &r) {
 	local_->get(l, r);
 	if (!calibrated_) return false;
-	if (l.empty()) return false;
+	if (l.empty() || r.empty()) {
+		LOG(ERROR) << "l/r empty in undistort()!!!";
+		return false;
+	}
 	remap(l, l, map1_[0], map2_[0], INTER_LINEAR);
 	if (local_->isStereo()) remap(r, r, map1_[1], map2_[1], INTER_LINEAR);
 	return true;
-- 
GitLab