From c3eba42437be71b5be2bbf793bcc9dca90337e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Tue, 8 Oct 2024 12:49:33 +0200 Subject: [PATCH] ContributedPartRenderer$1.setFocus: prevent NPE #2367 during PartRenderingEngineTests https://github.com/eclipse-platform/eclipse.platform.ui/issues/2367 --- .../ui/workbench/renderers/swt/ContributedPartRenderer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributedPartRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributedPartRenderer.java index b751024b6ac..dcbc5ef566f 100644 --- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributedPartRenderer.java +++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributedPartRenderer.java @@ -103,8 +103,10 @@ public boolean setFocus() { Object object = part.getObject(); if (object != null && isEnabled()) { IPresentationEngine pe = part.getContext().get(IPresentationEngine.class); - pe.focusGui(part); - return true; + if (pe != null) { + pe.focusGui(part); + return true; + } } return super.setFocus(); } finally {