From fe74bcb2955c6ae2c750bab2ee51537c9781ec6c Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Thu, 23 Feb 2023 17:13:37 +0100
Subject: [PATCH] Use at accessor instead of [] in CbmMatch to throw in case of
 invalid access, #2003

---
 core/data/CbmMatch.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/data/CbmMatch.h b/core/data/CbmMatch.h
index 9c4336cc38..6690700f39 100644
--- a/core/data/CbmMatch.h
+++ b/core/data/CbmMatch.h
@@ -36,9 +36,9 @@ public:
   virtual ~CbmMatch();
 
   /* Accessors */
-  const CbmLink& GetLink(int32_t i) const { return fLinks[i]; }
+  const CbmLink& GetLink(int32_t i) const { return fLinks.at(i); }
   const std::vector<CbmLink>& GetLinks() const { return fLinks; }
-  const CbmLink& GetMatchedLink() const { return fLinks[fMatchedIndex]; }
+  const CbmLink& GetMatchedLink() const { return fLinks.at(fMatchedIndex); }
   int32_t GetNofLinks() const { return fLinks.size(); }
   double GetTotalWeight() const { return fTotalWeight; }
 
-- 
GitLab