From 41e1e3ffcccd9c4253f76d68bf5324a8092eac6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Tue, 12 Mar 2024 17:19:11 +0100 Subject: [PATCH] fix possible NPE in CommandProvider.getElements during shutdown #1067 https://github.com/eclipse-platform/eclipse.platform.ui/issues/1067 --- .../ui/internal/quickaccess/providers/CommandProvider.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/providers/CommandProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/providers/CommandProvider.java index 53e7c63dbe0..76fbeb8dc68 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/providers/CommandProvider.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/providers/CommandProvider.java @@ -79,6 +79,9 @@ public QuickAccessElement findElement(String id, String filterText) { public QuickAccessElement[] getElements() { if (!allCommandsRetrieved) { ICommandService commandService = getCommandService(); + if (commandService == null) { + return null; + } Collection commandIds = commandService.getDefinedCommandIds(); for (String commandId : commandIds) { retrieveCommand(commandId);