commit 5a62e37adda7cb1882c048809d39c29bd9f27265
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Thu Mar 9 14:41:27 2017 +0100
Handle the case where doc_bv is null
It might only happens in specific cases where no file is open and for
some reason the new file cannot be opened.
---
src/frontends/qt4/GuiApplication.cpp | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/frontends/qt4/GuiApplication.cpp
b/src/frontends/qt4/GuiApplication.cpp
index 0eb55ba..05b7a25 100644
--- a/src/frontends/qt4/GuiApplication.cpp
+++ b/src/frontends/qt4/GuiApplication.cpp
@@ -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)