Changeset

13171:e2c3582ab9fa

util.jsonpointer: Silence Teal warning It seems to think 'table' never has array items, but we don't know that.
author Kim Alvefur <zash@zash.se>
date Fri, 30 Jun 2023 15:02:26 +0200
parents 13170:082c7d856e61
children 13172:9364f0b5ecae
files teal-src/prosody/util/jsonpointer.tl
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/teal-src/prosody/util/jsonpointer.tl	Thu Jun 29 15:36:13 2023 +0100
+++ b/teal-src/prosody/util/jsonpointer.tl	Fri Jun 30 15:02:26 2023 +0200
@@ -23,7 +23,7 @@
 			new_ref = ref[token]
 		elseif idx is integer then
 			local i = tonumber(token)
-			if token == "-" then i = #ref + 1 end
+			if token == "-" then i = #(ref as {any}) + 1 end
 			new_ref = ref[i+1]
 		else
 			return nil, "invalid-table"