]> git.lyx.org Git - features.git/commitdiff
Only set buffer if it is not null.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Tue, 24 Nov 2020 21:57:12 +0000 (16:57 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Tue, 24 Nov 2020 22:07:16 +0000 (17:07 -0500)
Yuriy found these specific problems. They do not cause a crash, but
they are not good.

src/mathed/InsetMathMacro.cpp
src/mathed/InsetMathNest.cpp

index 2ecef18a52154cd8456306200a00eedd98c1dca6..f1a84cd57343da6d5b8c8b29a8e741bd62d4d546 100644 (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);
 }
 
index ada0400f18f51045eff592b219a648477c3d8820..97db3cc47686de24e2027ea22952813e170df57e 100644 (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);
 }