X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FMetricsInfo.cpp;h=e7de5d0ea5d7973c729e7a385a39cea28980ced3;hb=294e4884ee29585d311177406cd31499e6d81877;hp=537efd351b875b086b091914f32b7c2ae19ae1e7;hpb=a187cbeb64a9bb02d38d22f8a5249d149a224070;p=lyx.git diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 537efd351b..e7de5d0ea5 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -153,19 +153,21 @@ void PainterInfo::draw(int x, int y, docstring const & str) ColorCode PainterInfo::backgroundColor(Inset const * inset, bool sel) const { - ColorCode const color_bg = inset->backgroundColor(*this); - if (selected && sel) // This inset is in a selection return Color_selection; - if (pain.develMode() && !inset->isBufferValid()) - // This inset is in error - return Color_error; + // special handling for inset background + if (inset != nullptr) { + if (pain.develMode() && !inset->isBufferValid()) + // This inset is in error + return Color_error; - if (color_bg != Color_none) - // This inset has its own color - return color_bg; + ColorCode const color_bg = inset->backgroundColor(*this); + if (color_bg != Color_none) + // This inset has its own color + return color_bg; + } if (background_color == Color_none) // This inset has no own color and does not inherit a color