]> granicus.if.org Git - clang/commitdiff
Minor fix: don't crash on empty configuration file, consider empty configuration...
authorAlexander Kornienko <alexfh@google.com>
Mon, 20 May 2013 15:18:01 +0000 (15:18 +0000)
committerAlexander Kornienko <alexfh@google.com>
Mon, 20 May 2013 15:18:01 +0000 (15:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182290 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp

index 64a988df31b2d1d50ce9579f26089c91298354c5..9be917c799f9048204bf07a1be115a2f60db7c4e 100644 (file)
@@ -201,6 +201,8 @@ bool getPredefinedStyle(StringRef Name, FormatStyle *Style) {
 }
 
 llvm::error_code parseConfiguration(StringRef Text, FormatStyle *Style) {
+  if (Text.trim().empty())
+    return llvm::make_error_code(llvm::errc::invalid_argument);
   llvm::yaml::Input Input(Text);
   Input >> *Style;
   return Input.error();