From fe55daa01f4c2c25adde9d714c60d11750145ade Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 17 Jul 2023 10:47:58 +0200 Subject: [PATCH] SEBSERV-450 fixed. --- .../ethz/seb/sebserver/gui/table/EntityTable.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/table/EntityTable.java b/src/main/java/ch/ethz/seb/sebserver/gui/table/EntityTable.java index 74a5d295..4015b6cd 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/table/EntityTable.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/table/EntityTable.java @@ -224,6 +224,9 @@ public class EntityTable { } this.table.addListener(SWT.Selection, event -> { if (this.multiselection != null && event.item != null) { + if (event.item == null || event.item.isDisposed()) { + return; + } handleMultiSelection((TableItem) event.item); event.doit = false; } @@ -527,6 +530,9 @@ public class EntityTable { // first remove all rows if there are some this.table.removeAll(); + if (this.multiselection != null) { + this.multiselection.clear(); + } // get page data and create rows final Page page = this.pageSupplier.newBuilder() @@ -642,10 +648,19 @@ public class EntityTable { @SuppressWarnings("unchecked") private ROW getRowData(final TableItem item) { + if (item == null || item.isDisposed()) { + log.warn("Selected item is null or disposed: {}", item); + return null; + } return (ROW) item.getData(TABLE_ROW_DATA); } private EntityKey getEntityKey(final TableItem item) { + if (item == null || item.isDisposed()) { + log.warn("Selected item is null or disposed: {}", item); + return null; + } + final ROW rowData = getRowData(item); if (rowData instanceof Entity) { return ((Entity) rowData).getEntityKey();