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

修改空指针异常

parent b8fab54e
...@@ -137,16 +137,18 @@ public class AgentApplicationInfoConvert { ...@@ -137,16 +137,18 @@ public class AgentApplicationInfoConvert {
commConfig.setContinuousQuestionTurn(entity.getContinuousQuestionTurn()); commConfig.setContinuousQuestionTurn(entity.getContinuousQuestionTurn());
List<Variable> variables = new ArrayList<>(); List<Variable> variables = new ArrayList<>();
String[] variableStructure = entity.getVariableStructure(); String[] variableStructure = entity.getVariableStructure();
for (int i = 0; i < variableStructure.length; i++) { if(variableStructure != null){
Variable variable = new Variable(); for (int i = 0; i < variableStructure.length; i++) {
String input = variableStructure[i]; Variable variable = new Variable();
// 定义正则表达式模式 String input = variableStructure[i];
Pattern pattern = Pattern.compile("(key|default):([^,]+)"); // 定义正则表达式模式
Matcher matcher = pattern.matcher(input); Pattern pattern = Pattern.compile("(key|default):([^,]+)");
if (matcher.find()) { Matcher matcher = pattern.matcher(input);
variable.setKey(matcher.group(1)); if (matcher.find()) {
variable.setVariableDefault(matcher.group(2)); variable.setKey(matcher.group(1));
variables.add(variable); variable.setVariableDefault(matcher.group(2));
variables.add(variable);
}
} }
} }
commConfig.setVariableStructure(variables); 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