findadv: amend [8c101829/lyxgit] check that opt.find_buf_name is found in theBuffers().

This commit is contained in:
Tommaso Cucinotta 2017-05-03 17:32:31 +02:00
parent 100a7ee22f
commit cf6bbe2147

View File

@ -1425,7 +1425,9 @@ static void changeFirstCase(Buffer & buffer, TextCase first_case, TextCase other
static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, MatchStringAdv & matchAdv)
{
Cursor & cur = bv->cursor();
if (opt.repl_buf_name == docstring())
if (opt.repl_buf_name == docstring()
|| theBufferList().getBuffer(FileName(to_utf8(opt.repl_buf_name)), true) == 0
|| theBufferList().getBuffer(FileName(to_utf8(opt.find_buf_name)), true) == 0)
return;
DocIterator sel_beg = cur.selectionBegin();
@ -1514,7 +1516,7 @@ bool findAdv(BufferView * bv, FindAndReplaceOptions const & opt)
// 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)
if (theBufferList().getBuffer(FileName(to_utf8(opt.find_buf_name)), true) == 0)
return false;
try {