Skip to content

Commit e904641

Browse files
Fix Exception when editing item
1 parent 2341d2e commit e904641

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,19 @@ private void onAcceptFilter()
374374
deletable = this.deletingBadgeEnabled;
375375
editable = this.editingBadgeEnabled;
376376

377-
// Get customization rating from initial condition
378-
customizationDegree = this.initialChipBadges
379-
.stream()
380-
.filter(e -> e.getBadgeId().equals(this.editingBadgeId))
381-
.toList()
382-
.get(0)
383-
.getCustomizationRating();
377+
this.deletingBadgeEnabled = null;
378+
this.editingBadgeEnabled = null;
379+
380+
if(this.editingBadgeEnabled != null)
381+
{
382+
// Get customization rating from initial condition
383+
customizationDegree = this.initialChipBadges
384+
.stream()
385+
.filter(e -> e.getBadgeId().equals(this.editingBadgeId))
386+
.toList()
387+
.get(0)
388+
.getCustomizationRating();
389+
}
384390
}
385391
else
386392
{
@@ -468,11 +474,7 @@ private void onAcceptFilter()
468474
// Set the customization rating for the filter select and condition select
469475
this.setUsedCustomizationDegreeForComponents(customizationDegree);
470476

471-
// Just activated when the url parameters are activated
472-
if(!this.identifier.isBlank())
473-
{
474-
this.editingBadgeId = badge.getBadgeId();
475-
}
477+
this.editingBadgeId = badge.getBadgeId();
476478

477479
// Remove filter, update grid
478480
this.removeChipBadgeCondition(badge);

0 commit comments

Comments
 (0)