diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java index 2a8ba6e4f8..75a4b12008 100644 --- a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java @@ -497,9 +497,11 @@ public class DashboardService { setPlanId(layoutDTO); if (StringUtils.isBlank(layoutDTO.getPlanId())) { TestPlan latestPlanByProjectIds = extTestPlanMapper.getLatestPlanByProjectIds(hasReadProjectIds); - layoutDTO.setPlanId(latestPlanByProjectIds.getId()); - layoutDTO.setGroupId(latestPlanByProjectIds.getGroupId()); - layoutDTO.setProjectIds(List.of(latestPlanByProjectIds.getProjectId())); + if (latestPlanByProjectIds!=null) { + layoutDTO.setPlanId(latestPlanByProjectIds.getId()); + layoutDTO.setGroupId(latestPlanByProjectIds.getGroupId()); + layoutDTO.setProjectIds(List.of(latestPlanByProjectIds.getProjectId())); + } } } } else if (StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.BUG_COUNT.toString()) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/PermissionCheckService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/PermissionCheckService.java index c7a57d19e8..2b93dd1f67 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/PermissionCheckService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/PermissionCheckService.java @@ -116,6 +116,9 @@ public class PermissionCheckService { for (String projectId : projectIds) { List userRolePermissions = projectPermissionMap.get(projectId); + if (CollectionUtils.isEmpty(userRolePermissions)) { + continue; + } for (UserRolePermission userRolePermission : userRolePermissions) { if (permissions.contains(userRolePermission.getPermissionId())) { permissionProjectIdMap.computeIfAbsent(userRolePermission.getPermissionId(), key -> new LinkedHashSet<>()).add(projectId);