From 543b5959711abafd74d0b2eb661be15ff69a72a8 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Tue, 24 Oct 2023 04:23:18 -0700 Subject: [PATCH] Fix internal incensistency in parsing code PiperOrigin-RevId: 576094494 --- mediapipe/framework/tool/validate_name.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mediapipe/framework/tool/validate_name.cc b/mediapipe/framework/tool/validate_name.cc index 8f9be7687..4415f76b5 100644 --- a/mediapipe/framework/tool/validate_name.cc +++ b/mediapipe/framework/tool/validate_name.cc @@ -134,7 +134,7 @@ absl::Status ParseTagAndName(absl::string_view tag_and_name, std::string* tag, RET_CHECK(name); absl::Status tag_status = absl::OkStatus(); absl::Status name_status = absl::UnknownError(""); - int name_index = 0; + int name_index = -1; std::vector v = absl::StrSplit(tag_and_name, ':'); if (v.size() == 1) { name_status = ValidateName(v[0]); @@ -143,7 +143,7 @@ absl::Status ParseTagAndName(absl::string_view tag_and_name, std::string* tag, tag_status = ValidateTag(v[0]); name_status = ValidateName(v[1]); name_index = 1; - } + } // else omitted, name_index == -1, triggering error. if (name_index == -1 || tag_status != absl::OkStatus() || name_status != absl::OkStatus()) { tag->clear();