This is an automated email from the ASF dual-hosted git repository.

dmeden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 4681638c04 CID1508922 - Fix Uncaught exception. (#11166)
4681638c04 is described below

commit 4681638c043a23834cec85a2d55a0cddd071881f
Author: Damian Meden <[email protected]>
AuthorDate: Wed Mar 20 10:31:44 2024 +0100

    CID1508922 - Fix Uncaught exception. (#11166)
---
 include/mgmt/rpc/jsonrpc/json/YAMLCodec.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/mgmt/rpc/jsonrpc/json/YAMLCodec.h 
b/include/mgmt/rpc/jsonrpc/json/YAMLCodec.h
index ce8eb5a7e4..cc29dfe2dd 100644
--- a/include/mgmt/rpc/jsonrpc/json/YAMLCodec.h
+++ b/include/mgmt/rpc/jsonrpc/json/YAMLCodec.h
@@ -50,12 +50,13 @@ class yamlcpp_json_decoder
   decode_and_validate(YAML::Node const &node) noexcept
   {
     specs::RPCRequestInfo request;
-    if (!node.IsDefined() || (node.Type() != YAML::NodeType::Map) || 
(node.size() == 0)) {
-      // We only care about structures with elements.
-      return {request, error::RPCErrorCode::INVALID_REQUEST};
-    }
 
     try {
+      if (!node.IsDefined() || (node.Type() != YAML::NodeType::Map) || 
(node.size() == 0)) {
+        // We only care about structures with elements.
+        return {request, error::RPCErrorCode::INVALID_REQUEST};
+      }
+
       // try the id first so we can use for a possible error.
       // All this may be obsolete if we decided to accept only strings.
       if (auto id = node["id"]) {

Reply via email to