From: Richard Heck Date: Sun, 12 Jun 2016 04:26:38 +0000 (-0400) Subject: Fix coverity issue #127197. X-Git-Tag: 2.3.0alpha1~1482 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a48adfa6d6b349f15c27e852e1c72a4f4c00880c;p=features.git Fix coverity issue #127197. We may fail to get a buffer when we request one. --- diff --git a/src/LyX.cpp b/src/LyX.cpp index b7b1edf915..66ff6f3dbe 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -490,14 +490,15 @@ int LyX::execWithoutGui(int & argc, char * argv[]) Buffer * buf = pimpl_->buffer_list_.newBuffer(fname.absFileName()); LYXERR(Debug::FILES, "Loading " << fname); - if (buf->loadLyXFile() == Buffer::ReadSuccess) { + if (buf && buf->loadLyXFile() == Buffer::ReadSuccess) { ErrorList const & el = buf->errorList("Parse"); if (!el.empty()) for_each(el.begin(), el.end(), bind(&LyX::printError, this, _1)); command_line_buffers.push_back(buf); } else { - pimpl_->buffer_list_.release(buf); + if (buf) + pimpl_->buffer_list_.release(buf); docstring const error_message = bformat(_("LyX failed to load the following file: %1$s"), from_utf8(fname.absFileName()));