Merge pull request #4373 from fedepell/whitelist_empty_bug

[JENKINS-60278] Prevent Oops when Whitelisted Commands input is empty
This commit is contained in:
Oleg Nenashev authored and GitHub committed 2019-12-04 05:38:35 +00:00
commit d7066d19ee
1 file changed
+1 -1
@@ -162,7 +162,7 @@ public class AdminWhitelistRule implements StaplerProxy {
@RequirePOST
public HttpResponse doSubmit(StaplerRequest req) throws IOException {
StringBuilder whitelist = new StringBuilder(Util.fixNull(req.getParameter("whitelist")));
if (whitelist.charAt(whitelist.length() - 1) != '\n')
if ((whitelist.length() > 0) && (whitelist.charAt(whitelist.length() - 1) != '\n'))
whitelist.append("\n");
Enumeration e = req.getParameterNames();