]> granicus.if.org Git - clang/commitdiff
Don't crash if SpecString is an empty string.
authorFrancois Pichet <pichet2000@gmail.com>
Sun, 9 Jan 2011 22:32:25 +0000 (22:32 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Sun, 9 Jan 2011 22:32:25 +0000 (22:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123134 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/TypePrinter.cpp

index 777835640d570871669fd8398b2ee1b0dc98b319..ef9704ec8581795f67bd7c8cd564e81bc287edbf 100644 (file)
@@ -870,7 +870,7 @@ TemplateSpecializationType::PrintTemplateArgumentList(
   // If the last character of our string is '>', add another space to
   // keep the two '>''s separate tokens. We don't *have* to do this in
   // C++0x, but it's still good hygiene.
-  if (SpecString[SpecString.size() - 1] == '>')
+  if (!SpecString.empty() && SpecString[SpecString.size() - 1] == '>')
     SpecString += ' ';
   
   if (!SkipBrackets)