Skip to content

Commit

Permalink
#50 added additional check in case the configuration is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Braz committed Jul 21, 2021
1 parent 8b53414 commit efe676f
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -29,6 +29,7 @@
import java.util.stream.Collectors;
import jenkins.model.GlobalConfiguration;
import jenkins.model.Jenkins;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -75,7 +76,8 @@ private void checkInvalidCloudCredentials(JSONObject formData) throws FormExcept
return;
}
JSONObject xrayInstances = formData.getJSONObject("xrayinstance");
if (!xrayInstances.has("serverInstances")) {
if (!xrayInstances.has("serverInstances") ||
!(xrayInstances.get("serverInstances") instanceof JSONArray)) {
return;
}
String xrayInstancesJson = xrayInstances.getJSONArray("serverInstances").toString();
Expand Down

0 comments on commit efe676f

Please sign in to comment.