From b8baca70774944ab194ac86b44d9bc8298949341 Mon Sep 17 00:00:00 2001 From: drjaska Date: Sun, 10 Nov 2024 13:58:49 +0200 Subject: [PATCH] Add a string_null check to inputbox input filter This check was forgotten and in the cases where the inputbox doesn't have a defined allowed characters list causes all input to be filtered. Fixes https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2946 --- qcsrc/menu/item/inputbox.qc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qcsrc/menu/item/inputbox.qc b/qcsrc/menu/item/inputbox.qc index 0d77e67b4..45321e917 100644 --- a/qcsrc/menu/item/inputbox.qc +++ b/qcsrc/menu/item/inputbox.qc @@ -111,8 +111,12 @@ int len = strlen(ch); for (int i = 0; i < len; ++i) { + // if there is a list of allowed characters, forbid all other + if (me.allowedCharacters != string_null + && strstrofs(me.allowedCharacters, substring(ch, i, 1), 0) == -1) return; + + // don't allow forbidden characters if (strstrofs(me.forbiddenCharacters, substring(ch, i, 1), 0) > -1) return; - if (strstrofs(me.allowedCharacters, substring(ch, i, 1), 0) == -1) return; } if (me.maxLength > 0) { -- 2.39.2