From 76fa0ec1773ad2189c7f97112aa69e2a2f47dbe2 Mon Sep 17 00:00:00 2001 From: HaseenaSainul <41037131+HaseenaSainul@users.noreply.github.com> Date: Mon, 8 Apr 2024 23:02:28 +0530 Subject: [PATCH] CPPSDK: ensure array has enough data before trying to access (#184) --- languages/cpp/templates/result-instantiation/tuple.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/languages/cpp/templates/result-instantiation/tuple.cpp b/languages/cpp/templates/result-instantiation/tuple.cpp index c94a7054..9ba6f3af 100644 --- a/languages/cpp/templates/result-instantiation/tuple.cpp +++ b/languages/cpp/templates/result-instantiation/tuple.cpp @@ -1,2 +1,5 @@ - ${property}.first = jsonResult.Get(0); - ${property}.second = jsonResult.Get(1); \ No newline at end of file + ASSERT((jsonResult.Length() == 0) || (jsonResult.Length() == 2)); + if (jsonResult.Length() == 2) { + ${property}.first = jsonResult.Get(0); + ${property}.second = jsonResult.Get(1); + }