Changeset

6321:e174e12549e1

mod_http_oauth2: Handle absent array argument in array member check Allows this argument to be optional and prevents an error attempting to obtain the length of nil.
author Kim Alvefur <zash@zash.se>
date Thu, 03 Jul 2025 12:27:32 +0200
parents 6320:ebcf612da2b1
children 6322:dfc035ecabb4
files mod_http_oauth2/mod_http_oauth2.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua	Thu Jul 03 12:14:53 2025 +0200
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Thu Jul 03 12:27:32 2025 +0200
@@ -29,6 +29,9 @@
 end
 
 local function array_contains(haystack, needle)
+	if not haystack then
+		return false
+	end
 	for i = 1, #haystack do
 		if haystack[i] == needle then
 			return true