From 02c7ba2ae2d782d7206a3488860635cd558f82c5 Mon Sep 17 00:00:00 2001 From: nikkoridi Date: Wed, 11 Jun 2025 15:21:11 +0300 Subject: [PATCH] Bug #3985 Fix NPE in External Storage Handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: When a query type wasn’t selected and the link “Add attribute” was clicked, a Null Pointer Exception happened. It happened because the link creation has an “onLinkActivated” method which requires “queryType” as a parameter. Solution: I added not null check before the link creation. Now the link appears only after the query type is selected in the drop-down list. --- ...CommonStorageHandlerCellEditorProvider.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/ru.runa.gpd.office/src/ru/runa/gpd/office/store/BaseCommonStorageHandlerCellEditorProvider.java b/plugins/ru.runa.gpd.office/src/ru/runa/gpd/office/store/BaseCommonStorageHandlerCellEditorProvider.java index c07e2a634..67fd2beb4 100644 --- a/plugins/ru.runa.gpd.office/src/ru/runa/gpd/office/store/BaseCommonStorageHandlerCellEditorProvider.java +++ b/plugins/ru.runa.gpd.office/src/ru/runa/gpd/office/store/BaseCommonStorageHandlerCellEditorProvider.java @@ -147,14 +147,16 @@ public void modifyText(ModifyEvent e) { new Label(this, SWT.NONE); } - SwtUtils.createLink(this, Messages.getString("label.AddVar"), new LoggingHyperlinkAdapter() { - - @Override - protected void onLinkActivated(HyperlinkEvent e) throws Exception { - model.constraints.add(new StorageConstraintsModel(StorageConstraintsModel.ATTR, queryType)); - buildFromModel(); - } - }).setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END)); + if (queryType != null) { + SwtUtils.createLink(this, Messages.getString("label.AddVar"), new LoggingHyperlinkAdapter() { + + @Override + protected void onLinkActivated(HyperlinkEvent e) throws Exception { + model.constraints.add(new StorageConstraintsModel(StorageConstraintsModel.ATTR, queryType)); + buildFromModel(); + } + }).setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END)); + } new Label(this, SWT.NONE); warning = new Label(this, SWT.NONE); warning.setForeground(darkRed);