From 95b4e724c86e59da6adf57f7d81e438e659337a5 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Tue, 10 Jun 2008 10:26:55 +0000 Subject: [PATCH] Fix for 233866: NPE on Fresh installed Windows/CDT, patch by Enrico Ehrich --- .../gnu/cygwin/CygwinPathResolver.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/CygwinPathResolver.java b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/CygwinPathResolver.java index 752b796f84e..d0ab0c676b3 100644 --- a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/CygwinPathResolver.java +++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/CygwinPathResolver.java @@ -6,7 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Intel Corporation - Initial API and implementation + * Intel Corporation - Initial API and implementation + * Enrico Ehrich - http://bugs.eclipse.org/233866 *******************************************************************************/ package org.eclipse.cdt.managedbuilder.gnu.cygwin; @@ -134,11 +135,15 @@ public class CygwinPathResolver implements IBuildPathResolver { String tail = EMPTY; while (pattern.length() > 0) { String key = REGISTRY_KEY + pattern; - String s = user ? - WindowsRegistry.getRegistry().getCurrentUserValue(key, PATH_NAME) : - WindowsRegistry.getRegistry().getLocalMachineValue(key, PATH_NAME); - if (s != null) - return (s.concat(tail).replaceAll(BSLASH, SSLASH)); + WindowsRegistry registry = WindowsRegistry.getRegistry(); + if (null != registry) { + String s = user ? + registry.getCurrentUserValue(key, PATH_NAME) : + registry.getLocalMachineValue(key, PATH_NAME); + + if (s != null) + return (s.concat(tail).replaceAll(BSLASH, SSLASH)); + } if (pattern.equals(ROOTPATTERN)) break; // no other paths to search int pos = pattern.lastIndexOf(SLASH);