mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Fix coverity issue #127197.
We may fail to get a buffer when we request one.
This commit is contained in:
parent
f19d650752
commit
a48adfa6d6
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user