We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf9a113 commit 0e0c0feCopy full SHA for 0e0c0fe
bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java
@@ -213,8 +213,10 @@ public String webFormUpdateBook(
213
Book bookI = bookRepository.findByIsbn(book.getIsbn());
214
215
// If existing ISBN value is not attached to the current book...
216
- if (bookI.getId() != book.getId()) {
217
- bindingResult.rejectValue("isbn", "error.user", "ISBN code already exists");
+ if (bookI != null) {
+ if (bookI.getId() != book.getId()) {
218
+ bindingResult.rejectValue("isbn", "error.user", "ISBN code already exists");
219
+ }
220
}
221
222
if (bindingResult.hasErrors()) {
0 commit comments