From 6f760939f3bd727902ede7480d5f31058b198044 Mon Sep 17 00:00:00 2001 From: NEZNAMY Date: Sat, 26 Oct 2024 21:23:17 +0200 Subject: [PATCH] [Placeholders] Add validation check to PlaceholderManagerImpl#getPlaceholder --- .../me/neznamy/tab/shared/features/PlaceholderManagerImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared/src/main/java/me/neznamy/tab/shared/features/PlaceholderManagerImpl.java b/shared/src/main/java/me/neznamy/tab/shared/features/PlaceholderManagerImpl.java index d8545487c..55df9854f 100644 --- a/shared/src/main/java/me/neznamy/tab/shared/features/PlaceholderManagerImpl.java +++ b/shared/src/main/java/me/neznamy/tab/shared/features/PlaceholderManagerImpl.java @@ -404,6 +404,9 @@ public Placeholder getPlaceholderRaw(@NotNull String identifier) { @Override @NotNull public synchronized TabPlaceholder getPlaceholder(@NonNull String identifier) { + if (identifier.charAt(0) != '%' || identifier.charAt(identifier.length() - 1) != '%') { + throw new IllegalArgumentException("Placeholder identifier must start and end with %"); + } TabPlaceholder p = (TabPlaceholder) registeredPlaceholders.get(identifier); if (p == null) { TabPlaceholderRegisterEvent event = new TabPlaceholderRegisterEvent(identifier);