forked from OSchip/llvm-project
[yaml2obj] - Don't crash on invalid document.
Previously jaml2obj would segfault on empty document. (without yaml description). Patch fixes the issue. Differential revision: https://reviews.llvm.org/D38036 llvm-svn: 313746
This commit is contained in:
parent
b0f0a1ea03
commit
cefe7e1142
|
@ -1418,8 +1418,8 @@ inline typename std::enable_if<has_MappingTraits<T, EmptyContext>::value,
|
|||
Input &>::type
|
||||
operator>>(Input &yin, T &docMap) {
|
||||
EmptyContext Ctx;
|
||||
yin.setCurrentDocument();
|
||||
yamlize(yin, docMap, true, Ctx);
|
||||
if (yin.setCurrentDocument())
|
||||
yamlize(yin, docMap, true, Ctx);
|
||||
return yin;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
# RUN: not yaml2obj %s 2>&1 | FileCheck %s
|
||||
# CHECK: Unknown document type!
|
Loading…
Reference in New Issue