mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Check whether the buffer pointer is valid before using it
This commit is contained in:
parent
fee356eb56
commit
d275d034c0
@ -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_;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user