From 290593003b4c4a6856eb9ee40f19f240a7ae042a Mon Sep 17 00:00:00 2001 From: Rohit Verma Date: Mon, 28 Oct 2024 02:03:15 -0700 Subject: [PATCH] fix for issue 237 --- remote_function/udf_server.py | 2 ++ src/ImageLoop.cc | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/remote_function/udf_server.py b/remote_function/udf_server.py index 17a5caca..d5f0dfc3 100644 --- a/remote_function/udf_server.py +++ b/remote_function/udf_server.py @@ -56,6 +56,8 @@ def image_api(): return_string += r_meta.encode("utf-8") os.remove(tmpfile) + if return_string == "" or return_string == None: + return "error" return return_string diff --git a/src/ImageLoop.cc b/src/ImageLoop.cc index e4dcef59..057b9fe4 100644 --- a/src/ImageLoop.cc +++ b/src/ImageLoop.cc @@ -330,11 +330,15 @@ void ImageLoop::execute_remote_operations( continue; } cv::Mat dmat = write_image(responseBuffer[rindex]); + if (dmat.rows == 0 || dmat.cols == 0){ + throw VCLException(ObjectEmpty, + "Invalid response from the remote server."); + } if (dmat.empty()) { pendingImages.push_back(img); } - img->shallow_copy_cv(dmat); + img->shallow_copy_cv(dmat); img->update_op_completed(); auto const result = imageMap.insert(