From: Jordan Rose Date: Fri, 31 Aug 2012 00:36:20 +0000 (+0000) Subject: [analyzer] Fix a crash in plist-html generation introduced in r162939. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c916ee23c7c16e859eb55a907385f94039f8b27;p=clang [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 --- 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 << " \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 << " \n"; + } + lastName = newName; + o << " " << lastName << "_files\n"; + o << " \n"; } - lastName = newName; - o << " " << lastName << "_files\n"; - o << " \n"; + o << " " << CI->second << "\n"; } - o << " " << CI->second << "\n"; - } - if (!lastName.empty()) o << " \n"; + } } // Close up the entry.