Don't call back() on an empty SmallVector. Found by -fsanitize=enum!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170968 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/YAMLTraits.cpp b/lib/Support/YAMLTraits.cpp
index a31c319..8fcef40 100644
--- a/lib/Support/YAMLTraits.cpp
+++ b/lib/Support/YAMLTraits.cpp
@@ -516,7 +516,7 @@
void Output::outputUpToEndOfLine(StringRef s) {
this->output(s);
- if (StateStack.back() != inFlowSeq)
+ if (StateStack.empty() || StateStack.back() != inFlowSeq)
NeedsNewLine = true;
}