findadv: fix crash on wrong syntax/usage of word-findadv LFUN from mini-command.

This commit is contained in:
Tommaso Cucinotta 2017-05-02 17:46:38 +02:00
parent 1b016f5f67
commit 3610cdf669

View File

@ -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();