1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

Add NPE guard in DwarfReader.fixupMacros() method.

Change-Id: I27222d664d671149538630086b655506c07da247
Reviewed-on: https://git.eclipse.org/r/28290
Tested-by: Hudson CI
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
Tested-by: Jeff Johnston <jjohnstn@redhat.com>
This commit is contained in:
Jeff Johnston 2014-06-10 14:33:13 -04:00
parent 5895297a04
commit 5292097296

View file

@ -793,21 +793,23 @@ public class DwarfReader extends Dwarf implements ISymbolReader, ICompileOptions
HashMap<Long, ArrayList<String>> t_macros) {
for (String name: fixupList) {
ArrayList<String> macros = m_compileOptionsMap.get(name);
for (int i = 0; i < macros.size(); ++i) {
String macroLine = macros.get(i);
if (macroLine.startsWith(fixupMarker)) {
Long offset = Long.valueOf(macroLine.substring(7));
if (DEBUG)
System.out.println("Found fixup needed for offset: " + offset + " for file: " + name); //$NON-NLS-1$ //$NON-NLS-2$
ArrayList<String> insertMacros = t_macros.get(offset);
if (DEBUG)
System.out.println("insert macros are: " + insertMacros.toString()); //$NON-NLS-1$
macros.remove(i);
macros.addAll(i, insertMacros);
i += insertMacros.size();
if (macros != null) {
for (int i = 0; i < macros.size(); ++i) {
String macroLine = macros.get(i);
if (macroLine.startsWith(fixupMarker)) {
Long offset = Long.valueOf(macroLine.substring(7));
if (DEBUG)
System.out.println("Found fixup needed for offset: " + offset + " for file: " + name); //$NON-NLS-1$ //$NON-NLS-2$
ArrayList<String> insertMacros = t_macros.get(offset);
if (DEBUG)
System.out.println("insert macros are: " + insertMacros.toString()); //$NON-NLS-1$
macros.remove(i);
macros.addAll(i, insertMacros);
i += insertMacros.size();
}
}
m_compileOptionsMap.put(name, macros); // replace updated list
}
m_compileOptionsMap.put(name, macros); // replace updated list
}
}