fixes misbehavior when a non-existing project ID is selected

Sat, 29 Aug 2020 17:32:59 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 29 Aug 2020 17:32:59 +0200
changeset 107
b5f740a87af4
parent 106
9c6ebf67afe9
child 108
6657dad897ea

fixes misbehavior when a non-existing project ID is selected

src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sat Aug 29 17:28:24 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sat Aug 29 17:32:59 2020 +0200
@@ -158,10 +158,14 @@
         final int pid = syncParamWithSession(req, PARAMETER_SELECTED_PROJECT, SESSION_ATTR_SELECTED_PROJECT);
         if (pid >= 0) {
             final var project = projectDao.find(pid);
-            final var info = new ProjectInfo(project);
-            info.setVersions(versionDao.list(project));
-            info.setIssueSummary(projectDao.getIssueSummary(project));
-            viewModel.setProjectInfo(info);
+            if (project == null) {
+                req.setAttribute(SESSION_ATTR_SELECTED_PROJECT, -1);
+            } else {
+                final var info = new ProjectInfo(project);
+                info.setVersions(versionDao.list(project));
+                info.setIssueSummary(projectDao.getIssueSummary(project));
+                viewModel.setProjectInfo(info);
+            }
         }
 
         // Select Version

mercurial