Commit 9c34cbfd authored by jennie chen's avatar jennie chen

修改空指针异常

parent b8fab54e
......@@ -137,16 +137,18 @@ public class AgentApplicationInfoConvert {
commConfig.setContinuousQuestionTurn(entity.getContinuousQuestionTurn());
List<Variable> variables = new ArrayList<>();
String[] variableStructure = entity.getVariableStructure();
for (int i = 0; i < variableStructure.length; i++) {
Variable variable = new Variable();
String input = variableStructure[i];
// 定义正则表达式模式
Pattern pattern = Pattern.compile("(key|default):([^,]+)");
Matcher matcher = pattern.matcher(input);
if (matcher.find()) {
variable.setKey(matcher.group(1));
variable.setVariableDefault(matcher.group(2));
variables.add(variable);
if(variableStructure != null){
for (int i = 0; i < variableStructure.length; i++) {
Variable variable = new Variable();
String input = variableStructure[i];
// 定义正则表达式模式
Pattern pattern = Pattern.compile("(key|default):([^,]+)");
Matcher matcher = pattern.matcher(input);
if (matcher.find()) {
variable.setKey(matcher.group(1));
variable.setVariableDefault(matcher.group(2));
variables.add(variable);
}
}
}
commConfig.setVariableStructure(variables);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment