From d88315212b79fb9afe30615eab93b8f4d87e5c12 Mon Sep 17 00:00:00 2001 From: figamore <90107339+figamore@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:48:26 -0400 Subject: [PATCH] fix params passing structure --- cc/tracking/Trackers/TrackerNano.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cc/tracking/Trackers/TrackerNano.cc b/cc/tracking/Trackers/TrackerNano.cc index 591786e2..070b5530 100644 --- a/cc/tracking/Trackers/TrackerNano.cc +++ b/cc/tracking/Trackers/TrackerNano.cc @@ -77,16 +77,21 @@ NAN_METHOD(TrackerNano::New) { FF::TryCatch tryCatch("TrackerNano::New"); FF_ASSERT_CONSTRUCT_CALL(); - // Initialize default model paths + // Default model paths std::string backboneModelPath = "backbone.onnx"; std::string neckheadModelPath = "neckhead.onnx"; - // Check if user passed model paths as arguments - if (info.Length() > 0 && info[0]->IsString()) { - backboneModelPath = *v8::String::Utf8Value(info[0]->ToString()); + // Check if the user passed model paths as arguments + if (info.Length() > 0) { + if (FF::StringConverter::arg(0, &backboneModelPath, info)) { + return tryCatch.reThrow(); + } } - if (info.Length() > 1 && info[1]->IsString()) { - neckheadModelPath = *v8::String::Utf8Value(info[1]->ToString()); + + if (info.Length() > 1) { + if (FF::StringConverter::arg(1, &neckheadModelPath, info)) { + return tryCatch.reThrow(); + } } // Initialize TrackerNano with provided or default models @@ -105,7 +110,7 @@ NAN_METHOD(TrackerNano::New) { self->Wrap(info.Holder()); info.GetReturnValue().Set(info.Holder()); -}; +} #endif