Skip to content

Commit 72bc2dc

Browse files
authored
fix(autoware_tensorrt_yolox): fix bugprone-exception-escape (#9734)
* fix: bugprone-error Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp> * fix: fmt Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp> * fix: fmt Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp> --------- Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
1 parent a499a0a commit 72bc2dc

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

perception/autoware_tensorrt_yolox/src/tensorrt_yolox.cpp

+15-9
Original file line numberDiff line numberDiff line change
@@ -341,16 +341,22 @@ TrtYoloX::TrtYoloX(
341341

342342
TrtYoloX::~TrtYoloX()
343343
{
344-
if (use_gpu_preprocess_) {
345-
if (image_buf_h_) {
346-
image_buf_h_.reset();
347-
}
348-
if (image_buf_d_) {
349-
image_buf_d_.reset();
350-
}
351-
if (argmax_buf_d_) {
352-
argmax_buf_d_.reset();
344+
try {
345+
if (use_gpu_preprocess_) {
346+
if (image_buf_h_) {
347+
image_buf_h_.reset();
348+
}
349+
if (image_buf_d_) {
350+
image_buf_d_.reset();
351+
}
352+
if (argmax_buf_d_) {
353+
argmax_buf_d_.reset();
354+
}
353355
}
356+
} catch (const std::exception & e) {
357+
std::cerr << "Exception in TrtYoloX destructor: " << e.what() << std::endl;
358+
} catch (...) {
359+
std::cerr << "Unknown exception in TrtYoloX destructor" << std::endl;
354360
}
355361
}
356362

0 commit comments

Comments
 (0)