1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Fix for 233866: NPE on Fresh installed Windows/CDT, patch by Enrico Ehrich <public@snipah.com>

This commit is contained in:
Anton Leherbauer 2008-06-10 10:26:55 +00:00
parent ac107ff7ab
commit 95b4e724c8

View file

@ -7,6 +7,7 @@
* *
* Contributors: * 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; package org.eclipse.cdt.managedbuilder.gnu.cygwin;
@ -134,11 +135,15 @@ public class CygwinPathResolver implements IBuildPathResolver {
String tail = EMPTY; String tail = EMPTY;
while (pattern.length() > 0) { while (pattern.length() > 0) {
String key = REGISTRY_KEY + pattern; String key = REGISTRY_KEY + pattern;
WindowsRegistry registry = WindowsRegistry.getRegistry();
if (null != registry) {
String s = user ? String s = user ?
WindowsRegistry.getRegistry().getCurrentUserValue(key, PATH_NAME) : registry.getCurrentUserValue(key, PATH_NAME) :
WindowsRegistry.getRegistry().getLocalMachineValue(key, PATH_NAME); registry.getLocalMachineValue(key, PATH_NAME);
if (s != null) if (s != null)
return (s.concat(tail).replaceAll(BSLASH, SSLASH)); return (s.concat(tail).replaceAll(BSLASH, SSLASH));
}
if (pattern.equals(ROOTPATTERN)) if (pattern.equals(ROOTPATTERN))
break; // no other paths to search break; // no other paths to search
int pos = pattern.lastIndexOf(SLASH); int pos = pattern.lastIndexOf(SLASH);