Only set buffer if it is not null.

Yuriy found these specific problems. They do not cause a crash, but
they are not good.
This commit is contained in:
Richard Kimberly Heck 2020-11-24 16:57:12 -05:00
parent 5691b89858
commit 2ae77d5091
2 changed files with 10 additions and 2 deletions

View File

@ -307,7 +307,11 @@ InsetMathMacro::InsetMathMacro(Buffer * buf, docstring const & name)
InsetMathMacro::InsetMathMacro(InsetMathMacro const & that)
: InsetMathNest(that), d(new Private(*that.d))
{
setBuffer(*that.buffer_);
// FIXME This should not really be necessary, but when we are
// initializing the table of global macros, we create macros
// with no associated Buffer.
if (that.buffer_)
setBuffer(*that.buffer_);
d->updateChildren(this);
}

View File

@ -85,7 +85,11 @@ using cap::selClearOrDel;
InsetMathNest::InsetMathNest(Buffer * buf, idx_type nargs)
: InsetMath(buf), cells_(nargs), lock_(false)
{
setBuffer(*buf);
// FIXME This should not really be necessary, but when we are
// initializing the table of global macros, we create macros
// with no associated Buffer.
if (buf)
setBuffer(*buf);
}