Skip to content

Commit e22962b

Browse files
committed
Fix NPE when trying to add image to non-existent series.
1 parent 18fe287 commit e22962b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/ru/mystamps/web/controller/SeriesController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ public String processImage(
209209
HttpServletResponse response)
210210
throws IOException {
211211

212+
if (series == null) {
213+
response.sendError(HttpServletResponse.SC_NOT_FOUND);
214+
return null;
215+
}
216+
212217
model.addAttribute("series", series);
213218
model.addAttribute("michelNumbers", CatalogUtils.toShortForm(series.getMichel()));
214219
model.addAttribute("scottNumbers", CatalogUtils.toShortForm(series.getScott()));
@@ -226,11 +231,6 @@ public String processImage(
226231
return "series/info";
227232
}
228233

229-
if (series == null) {
230-
response.sendError(HttpServletResponse.SC_NOT_FOUND);
231-
return null;
232-
}
233-
234234
seriesService.addImageToSeries(form, series, currentUser);
235235

236236
return redirectTo(Url.INFO_SERIES_PAGE, series.getId());

0 commit comments

Comments
 (0)