From 61b42d6ca28db2a44bf35e1b0b3de286fb13bfb7 Mon Sep 17 00:00:00 2001 From: Sydney Vo Date: Sat, 16 Nov 2024 03:12:37 +0000 Subject: [PATCH] Fix NPE in PDEModelUtility by adding null check (#1404) --- .../eclipse/pde/internal/ui/util/PDEModelUtility.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/PDEModelUtility.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/PDEModelUtility.java index ba458cfb4e..d40340007f 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/PDEModelUtility.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/PDEModelUtility.java @@ -54,6 +54,7 @@ import org.eclipse.pde.internal.ui.editor.build.BuildInputContext; import org.eclipse.pde.internal.ui.editor.build.BuildSourcePage; import org.eclipse.pde.internal.ui.editor.context.InputContext; +import org.eclipse.pde.internal.ui.editor.context.InputContextManager; import org.eclipse.pde.internal.ui.editor.plugin.ManifestEditor; import org.eclipse.pde.internal.ui.editor.schema.SchemaEditor; import org.eclipse.pde.internal.ui.editor.schema.SchemaInputContext; @@ -412,9 +413,13 @@ private static void modifyEditorModel(final ModelModification mod, final PDEForm for (IFile file : files) { if (file == null) continue; - InputContext con = editor.getContextManager().findContext(file); - if (con != null) - con.flushEditorInput(); + InputContextManager manager = editor.getContextManager(); + if (manager != null){ + InputContext con = manager.findContext(file); + if (con != null) { + con.flushEditorInput(); + } + } } if (mod.saveOpenEditor()) editor.doSave(monitor);