From d53c2ec21518aee0df3eef3476cc8f3f9fb7d1a5 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Thu, 6 Aug 2009 09:53:06 +0000 Subject: [PATCH] Fix bug #6014: Assertion when pasting "\def" into 2.0svn git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30870 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/MathMacroTemplate.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp index 3014cc4ee7..6cccd8fa6a 100644 --- a/src/mathed/MathMacroTemplate.cpp +++ b/src/mathed/MathMacroTemplate.cpp @@ -670,8 +670,10 @@ void MathMacroTemplate::shiftArguments(size_t from, int by) int MathMacroTemplate::maxArgumentInDefinition() const { + // We don't have a buffer when pasting from the clipboard (bug 6014). + Buffer const * macro_buffer = this->isBufferValid() ? &buffer() : 0; int maxArg = 0; - DocIterator it = doc_iterator_begin(&buffer(), this); + DocIterator it = doc_iterator_begin(macro_buffer, this); it.idx() = defIdx(); for (; it; it.forwardChar()) { if (!it.nextInset()) -- 2.39.2