Minor fix: don't crash on empty configuration file, consider empty configuration files invalid.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182290 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 64a988d..9be917c 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -201,6 +201,8 @@
}
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();