diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-08-31 00:36:20 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-08-31 00:36:20 +0000 |
commit | 7444f5d82661bb68d94e54452ccab6d1d0bfe423 (patch) | |
tree | 863d464c1f25c3bbdaf7d39541a685249e5008dd /clang/lib/StaticAnalyzer | |
parent | e423e865fe499c4eff6df005031a1799bb98e43c (diff) | |
download | bcm5719-llvm-7444f5d82661bb68d94e54452ccab6d1d0bfe423.tar.gz bcm5719-llvm-7444f5d82661bb68d94e54452ccab6d1d0bfe423.zip |
[analyzer] Fix a crash in plist-html generation introduced in r162939.
Basically, do the correct thing to fix the XML generation error, rather
than making it even worse by unilaterally dereferencing a null pointer.
llvm-svn: 162964
Diffstat (limited to 'clang/lib/StaticAnalyzer')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp index c038b632e9a..c1c46c293a7 100644 --- a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -500,21 +500,22 @@ void PlistDiagnostics::FlushDiagnosticsImpl( if (!filesMade->empty()) { StringRef lastName; PDFileEntry::ConsumerFiles *files = filesMade->getFiles(*D); - for (PDFileEntry::ConsumerFiles::const_iterator CI = files->begin(), - CE = files->end(); CI != CE; ++CI) { - StringRef newName = CI->first; - if (newName != lastName) { - if (!lastName.empty()) { - o << " </array>\n"; + if (files) { + for (PDFileEntry::ConsumerFiles::const_iterator CI = files->begin(), + CE = files->end(); CI != CE; ++CI) { + StringRef newName = CI->first; + if (newName != lastName) { + if (!lastName.empty()) { + o << " </array>\n"; + } + lastName = newName; + o << " <key>" << lastName << "_files</key>\n"; + o << " <array>\n"; } - lastName = newName; - o << " <key>" << lastName << "_files</key>\n"; - o << " <array>\n"; + o << " <string>" << CI->second << "</string>\n"; } - o << " <string>" << CI->second << "</string>\n"; - } - if (!lastName.empty()) o << " </array>\n"; + } } // Close up the entry. |