Skip to content

Commit

Permalink
fix: refine codes
Browse files Browse the repository at this point in the history
  • Loading branch information
halajohn committed Feb 6, 2025
1 parent 903646b commit 6df30dc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class audio_frame_t : public msg_t {
~audio_frame_t() override = default;

std::unique_ptr<audio_frame_t> clone() const {
TEN_ASSERT(c_msg, "Should not happen.");
if (c_msg == nullptr) {
TEN_ASSERT(0, "Should not happen.");
return nullptr;
}

ten_shared_ptr_t *cloned_msg = ten_msg_clone(c_msg, nullptr);
if (cloned_msg == nullptr) {
Expand Down
5 changes: 4 additions & 1 deletion core/include/ten_runtime/binding/cpp/detail/msg/cmd/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ class cmd_t : public msg_t {
// @}

std::unique_ptr<cmd_t> clone() const {
TEN_ASSERT(c_msg, "Should not happen.");
if (c_msg == nullptr) {
TEN_ASSERT(0, "Should not happen.");
return nullptr;
}

ten_shared_ptr_t *cloned_msg = ten_msg_clone(c_msg, nullptr);
if (cloned_msg == nullptr) {
Expand Down
5 changes: 4 additions & 1 deletion core/include/ten_runtime/binding/cpp/detail/msg/cmd_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ class cmd_result_t : public msg_t {
}

std::unique_ptr<cmd_result_t> clone() const {
TEN_ASSERT(c_msg, "Should not happen.");
if (c_msg == nullptr) {
TEN_ASSERT(0, "Should not happen.");
return nullptr;
}

ten_shared_ptr_t *cloned_msg = ten_msg_clone(c_msg, nullptr);
if (cloned_msg == nullptr) {
Expand Down
5 changes: 4 additions & 1 deletion core/include/ten_runtime/binding/cpp/detail/msg/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class data_t : public msg_t {
~data_t() override = default;

std::unique_ptr<data_t> clone() const {
TEN_ASSERT(c_msg, "Should not happen.");
if (c_msg == nullptr) {
TEN_ASSERT(0, "Should not happen.");
return nullptr;
}

ten_shared_ptr_t *cloned_msg = ten_msg_clone(c_msg, nullptr);
if (cloned_msg == nullptr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ class video_frame_t : public msg_t {
~video_frame_t() override = default;

std::unique_ptr<video_frame_t> clone() const {
TEN_ASSERT(c_msg, "Should not happen.");
if (c_msg == nullptr) {
TEN_ASSERT(0, "Should not happen.");
return nullptr;
}

ten_shared_ptr_t *cloned_msg = ten_msg_clone(c_msg, nullptr);
if (cloned_msg == nullptr) {
Expand Down

0 comments on commit 6df30dc

Please sign in to comment.