From 3610cdf66944dc790e2e3df666e99f33c45b1ede Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Tue, 2 May 2017 17:46:38 +0200 Subject: [PATCH] findadv: fix crash on wrong syntax/usage of word-findadv LFUN from mini-command. --- src/lyxfind.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index c743fb81a1..d789c01262 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -1512,6 +1512,11 @@ bool findAdv(BufferView * bv, FindAndReplaceOptions const & opt) DocIterator cur; int match_len = 0; + // e.g., when invoking word-findadv from mini-buffer wither with + // wrong options syntax or before ever opening advanced F&R pane + if (theBufferList().getBuffer(FileName(to_utf8(opt.find_buf_name))) == 0) + return false; + try { MatchStringAdv matchAdv(bv->buffer(), opt); int length = bv->cursor().selectionEnd().pos() - bv->cursor().selectionBegin().pos();