]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiApplication.cpp
New LFUN buffer-external-modification-clear
[lyx.git] / src / frontends / qt4 / GuiApplication.cpp
index 0eb55bad0266b8c6e43d336b1d9a51c3a1bcddf1..05b7a251cd971c3565dec0451e821f75647b716e 100644 (file)
@@ -1473,9 +1473,7 @@ void GuiApplication::gotoBookmark(unsigned int idx, bool openFile,
        // if the current buffer is not that one, switch to it.
        BufferView * doc_bv = current_view_ ?
                current_view_->documentBufferView() : 0;
-       // FIXME It's possible that doc_bv is null!!
-       // See coverity #102061
-       Cursor const old = doc_bv->cursor();
+       Cursor const * old = doc_bv ? &doc_bv->cursor() : 0;
        if (!doc_bv || doc_bv->buffer().fileName() != tmp.filename) {
                if (switchToBuffer) {
                        dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
@@ -1487,13 +1485,13 @@ void GuiApplication::gotoBookmark(unsigned int idx, bool openFile,
        }
 
        // moveToPosition try paragraph id first and then paragraph (pit, pos).
-       if (!doc_bv->moveToPosition(
+       if (!doc_bv || !doc_bv->moveToPosition(
                        tmp.bottom_pit, tmp.bottom_pos, tmp.top_id, tmp.top_pos))
                return;
 
        Cursor & cur = doc_bv->cursor();
-       if (cur != old)
-               notifyCursorLeavesOrEnters(old, cur);
+       if (old && cur != *old)
+               notifyCursorLeavesOrEnters(*old, cur);
 
        // bm changed
        if (idx == 0)