From 9c1040d7721fc0dcb7781f504cbfe60aa90c177b Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Fri, 28 Jan 2022 19:27:03 +0000 Subject: =?UTF-8?q?Fix=20depth=20=E2=89=A2.=20It=20returned=20negative=20v?= =?UTF-8?q?alues=20when=20it=20wasn't=20supposed=20to?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'array.c') diff --git a/array.c b/array.c index 3ec8639..e71d938 100644 --- a/array.c +++ b/array.c @@ -382,10 +382,10 @@ arraydepth(Array *a, int *uniform) *uniform = 1; for(int i = 0; i < a->size; i++){ int subdepth = arraydepth(a->arraydata[i], &subuniform); + if((subdepth != max && max != -1) || subuniform == 0) + *uniform = 0; if(subdepth > max) max = subdepth; - if((subdepth != subdepth && max != -1) || subuniform) - *uniform = 0; } return max+1; }else{ -- cgit v1.2.3