From d275d034c056ea38db70c9f713d5df0b91103d62 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Thu, 25 Jun 2015 01:25:42 +0200 Subject: [PATCH] Check whether the buffer pointer is valid before using it --- src/mathed/MathMacro.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 636d059a23..78ea2bb365 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_; } -- 2.39.5