Skip to content

Commit

Permalink
fix: avoid NPE found in the logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ursjoss committed Nov 15, 2024
1 parent 6b3143f commit daaf3cd
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,14 @@ protected void onSubmit(@NotNull final AjaxRequestTarget target) {
super.onSubmit(target);
Paper p = null;
final List<FileUpload> fileUploads = model.getObject();
for (final FileUpload upload : fileUploads) {
try {
p = paperService.saveAttachment(convertToPaperAttachment(upload));
} catch (final Exception ex) {
log.error("Unexpected error when uploading file {}: {}", upload.getClientFileName(), ex.getMessage());
error("Unexpected error saving file " + upload.getClientFileName() + ": " + ex.getMessage());
if (fileUploads != null) {
for (final FileUpload upload : fileUploads) {
try {
p = paperService.saveAttachment(convertToPaperAttachment(upload));
} catch (final Exception ex) {
log.error("Unexpected error when uploading file {}: {}", upload.getClientFileName(), ex.getMessage());
error("Unexpected error saving file " + upload.getClientFileName() + ": " + ex.getMessage());
}
}
}
if (p != null) {
Expand Down

0 comments on commit daaf3cd

Please sign in to comment.