Description
For example, in the todoapp the home page displays all the todo items, not yet completed vs completed.
If select "Buy Milk" (when not complete) and delete it, then the NPE is thrown.
This is ultimately because the list returned from ToDoItem#delete() is stale:
public List<ToDoItem> delete() { // obtain title first, because cannot reference object after deleted final String title = container.titleOf(this); final List<ToDoItem> returnList = actionInvocationContext.isLast() ? toDoItems.notYetComplete() : null; container.removeIfNotAlready(this); container.informUser( TranslatableString.tr("Deleted {title}", "title", title), this.getClass(), "delete"); return returnList; }
It ought not to return the current object about to be deleted.
Even so, we can handle this application programming error easily enough, by filtering out any null objects.