Add validation for filter inject argument
| @@ -1962,6 +1962,10 @@ function injectCallback(args, value) { | ||
| 1962 | 1962 | const filterFunction = args?.filter instanceof SlashCommandClosure ? closureToFilter(args.filter) : null; |
| 1963 | 1963 | value = value || ''; |
| 1964 | 1964 | |
| 1965 | + if (args?.filter && !String(filter ?? '').trim()) { | |
| 1966 | + throw new Error('Failed to parse the filter argument. Make sure it is a valid non-empty closure.'); | |
| 1967 | + } | |
| 1968 | + | |
| 1965 | 1969 | const prefixedId = `${SCRIPT_PROMPT_KEY}${id}`; |
| 1966 | 1970 | |
| 1967 | 1971 | if (!chat_metadata.script_injects) { |