]> git.lyx.org Git - features.git/commitdiff
findadv: amend [8c101829/lyxgit] check that opt.find_buf_name is found in theBuffers().
authorTommaso Cucinotta <tommaso@lyx.org>
Wed, 3 May 2017 15:32:31 +0000 (17:32 +0200)
committerTommaso Cucinotta <tommaso@lyx.org>
Wed, 3 May 2017 15:32:31 +0000 (17:32 +0200)
src/lyxfind.cpp

index d789c0126250a86905706e113ea441ac9bf63665..0ec9fcb7a039208226b4b3d0858dbd4ab1d48666 100644 (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 {