fix: 生产自定义字段报空指针 (#4308)

Co-authored-by: chenjianxing <jianxing.chen@fit2cloud.com>
This commit is contained in:
metersphere-bot 2021-07-02 09:49:58 +08:00 committed by GitHub
parent 94976e191d
commit 9eaa0b9179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -326,7 +326,7 @@ public class ApiAutomationService {
private int getNextNum(String projectId) {
ApiScenario apiScenario = extApiScenarioMapper.getNextNum(projectId);
if (apiScenario == null) {
if (apiScenario == null || apiScenario.getNum() == null) {
return 100001;
} else {
return Optional.of(apiScenario.getNum() + 1).orElse(100001);

View File

@ -359,7 +359,7 @@ public class ApiDefinitionService {
private int getNextNum(String projectId) {
ApiDefinition apiDefinition = extApiDefinitionMapper.getNextNum(projectId);
if (apiDefinition == null) {
if (apiDefinition == null || apiDefinition.getNum() == null) {
return 100001;
} else {
return Optional.of(apiDefinition.getNum() + 1).orElse(100001);

View File

@ -64,7 +64,7 @@ public class HistoricalDataUpgradeService {
private int getNextNum(String projectId) {
ApiScenario apiScenario = extApiScenarioMapper.getNextNum(projectId);
if (apiScenario == null) {
if (apiScenario == null || apiScenario.getNum() == null) {
return 100001;
} else {
return Optional.of(apiScenario.getNum() + 1).orElse(100001);

View File

@ -589,7 +589,7 @@ public class PerformanceTestService {
private int getNextNum(String projectId) {
LoadTest loadTest = extLoadTestMapper.getNextNum(projectId);
if (loadTest == null) {
if (loadTest == null || loadTest.getNum() == null) {
return 100001;
} else {
return Optional.of(loadTest.getNum() + 1).orElse(100001);

View File

@ -984,7 +984,7 @@ public class TestCaseService {
*/
private int getNextNum(String projectId) {
TestCase testCase = extTestCaseMapper.getMaxNumByProjectId(projectId);
if (testCase == null) {
if (testCase == null || testCase.getNum() == null) {
return 100001;
} else {
return Optional.ofNullable(testCase.getNum() + 1).orElse(100001);