commit d275d034c056ea38db70c9f713d5df0b91103d62 Author: Enrico Forestieri <for...@lyx.org> Date: Thu Jun 25 01:25:42 2015 +0200
Check whether the buffer pointer is valid before using it diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 636d059..78ea2bb 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -207,7 +207,7 @@ MathMacro::MathMacro(MathMacro const & that) // We need to update d->macro_ by ourselves because in this case // MathData::metrics() is not called when selecting a math inset DocIterator const & pos = d->macroBackup_.pos(); - d->macro_ = pos.buffer()->getMacro(name(), pos); + d->macro_ = pos.buffer() ? pos.buffer()->getMacro(name(), pos) : 0; if (!d->macro_) d->macro_ = &d->macroBackup_; } @@ -225,7 +225,7 @@ MathMacro & MathMacro::operator=(MathMacro const & that) // We need to update d->macro_ by ourselves because in this case // MathData::metrics() is not called when selecting a math inset DocIterator const & pos = d->macroBackup_.pos(); - d->macro_ = pos.buffer()->getMacro(name(), pos); + d->macro_ = pos.buffer() ? pos.buffer()->getMacro(name(), pos) : 0; if (!d->macro_) d->macro_ = &d->macroBackup_; }