From ff05196cfedbd4e62cc268246815ce587f0c67b8 Mon Sep 17 00:00:00 2001 From: Barijaona Ramaholimihaso Date: Sun, 4 Aug 2024 08:29:59 +0300 Subject: [PATCH] Add an assertion in childByIndex --- Vienna/Sources/Main window/TreeNode.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vienna/Sources/Main window/TreeNode.m b/Vienna/Sources/Main window/TreeNode.m index c2428f83d1..a2b04b8097 100644 --- a/Vienna/Sources/Main window/TreeNode.m +++ b/Vienna/Sources/Main window/TreeNode.m @@ -180,11 +180,11 @@ -(TreeNode *)childByName:(NSString *)childName } /* childByIndex - * Returns the TreeNode for the child at the specified index offset. (Note that we don't - * assert index here. The objectAtIndex function will take care of that for us.) + * Returns the TreeNode for the child at the specified index offset. */ -(TreeNode *)childByIndex:(NSInteger)index { + NSAssert(index>=0 && index < children.count, @"index beyond limits in childByIndex:"); return children[index]; }