Blob Blame History Raw
--- ./com.redhat.eclipse.cdt.autotools/src/com/redhat/eclipse/cdt/autotools/AutotoolsScannerInfo.java.fix2	2006-09-11 16:22:36.000000000 -0400
+++ ./com.redhat.eclipse.cdt.autotools/src/com/redhat/eclipse/cdt/autotools/AutotoolsScannerInfo.java	2006-09-11 16:45:51.000000000 -0400
@@ -278,29 +278,31 @@ public class AutotoolsScannerInfo implem
 		// Extract -D directives from the compilation string.
 		// TODO: Handle -U directives as well.
 		String cs = getCompilationString();
-		Pattern p4 = Pattern.compile(" -D");
-		String[] tokens = p4.split(cs);
-		for (int j = 1; j < tokens.length; ++j) {
-			String x = tokens[j].trim();
-			int eqSignIndex = x.indexOf('=');
-			if (eqSignIndex == -1) {
-				int firstSpace = x.indexOf(' ', eqSignIndex);
-				if (firstSpace != -1)
-					symbolMap.put(x.substring(0, firstSpace), "");
-				else
-					symbolMap.put(x, "");
-			}
-			else {
-				int endIndex = -1;
-				if (x.charAt(eqSignIndex + 1) == '\\' && x.charAt(eqSignIndex + 2) == '\"') {
-					endIndex = x.indexOf('\"', eqSignIndex + 3) + 1;
-				} else {
-					endIndex = x.indexOf(' ');
+		if (cs != null) {
+			Pattern p4 = Pattern.compile(" -D");
+			String[] tokens = p4.split(cs);
+			for (int j = 1; j < tokens.length; ++j) {
+				String x = tokens[j].trim();
+				int eqSignIndex = x.indexOf('=');
+				if (eqSignIndex == -1) {
+					int firstSpace = x.indexOf(' ', eqSignIndex);
+					if (firstSpace != -1)
+						symbolMap.put(x.substring(0, firstSpace), "");
+					else
+						symbolMap.put(x, "");
+				}
+				else {
+					int endIndex = -1;
+					if (x.charAt(eqSignIndex + 1) == '\\' && x.charAt(eqSignIndex + 2) == '\"') {
+						endIndex = x.indexOf('\"', eqSignIndex + 3) + 1;
+					} else {
+						endIndex = x.indexOf(' ');
+					}
+					if (endIndex <= 0)
+						symbolMap.put(x.substring(0,eqSignIndex), x.substring(eqSignIndex+1));
+					else
+						symbolMap.put(x.substring(0, eqSignIndex), x.substring(eqSignIndex+1, endIndex));
 				}
-				if (endIndex <= 0)
-					symbolMap.put(x.substring(0,eqSignIndex), x.substring(eqSignIndex+1));
-				else
-					symbolMap.put(x.substring(0, eqSignIndex), x.substring(eqSignIndex+1, endIndex));
 			}
 		}
 		// Add the defined symbols from ManagedBuildManager.  This will include
@@ -322,7 +324,7 @@ public class AutotoolsScannerInfo implem
 	
 	public void createIncludeChain(IFile include, IResource res) {
 		try {
-		include.setSessionProperty(OPEN_INCLUDE, res);
+			include.setSessionProperty(OPEN_INCLUDE, res);
 		} catch (CoreException e) {
 			// Do nothing
 		}