Prevent assertion with command 'buffer-switch xxx' in which xxx is not the name of a loaded buffer.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28966 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-03-29 02:29:15 +00:00
parent 966ea2752e
commit da242ecd12

View File

@ -1963,9 +1963,15 @@ bool GuiView::dispatch(FuncRequest const & cmd)
importDocument(to_utf8(cmd.argument()));
break;
case LFUN_BUFFER_SWITCH:
setBuffer(theBufferList().getBuffer(FileName(to_utf8(cmd.argument()))));
case LFUN_BUFFER_SWITCH: {
Buffer * buffer =
theBufferList().getBuffer(FileName(to_utf8(cmd.argument())));
if (buffer)
setBuffer(buffer);
else
bv->cursor().message(_("Document not loaded"));
break;
}
case LFUN_BUFFER_NEXT:
gotoNextOrPreviousBuffer(NEXTBUFFER);