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 | 8c916ee23c7c16e859eb55a907385f94039f8b27 (patch) | |
tree | b7f5732f181833617f0108a1c0e814b56149ddb9 | |
parent | a6c66cedc022c9e5d45a937d6b8cff491a6bf81b (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162964 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/StaticAnalyzer/Core/PlistDiagnostics.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp index c038b632e9..c1c46c293a 100644 --- a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ b/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. |