mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4380 Preferences : Changing scene font size when geo mech view is open causes crash
Guard access to annotationCollection, as this is nullptr for geo mech views.
This commit is contained in:
@@ -295,9 +295,12 @@ bool RimGridView::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType
|
||||
bool hasCustomFonts = Rim3dView::hasCustomFontSizes(fontSettingType, defaultFontSize);
|
||||
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
|
||||
{
|
||||
auto annotations = annotationCollection();
|
||||
RiaFontCache::FontSize defaultFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(defaultFontSize);
|
||||
hasCustomFonts = annotations->hasTextAnnotationsWithCustomFontSize(defaultFontSizeEnum) || hasCustomFonts;
|
||||
auto annotations = annotationCollection();
|
||||
if (annotations)
|
||||
{
|
||||
RiaFontCache::FontSize defaultFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(defaultFontSize);
|
||||
hasCustomFonts = annotations->hasTextAnnotationsWithCustomFontSize(defaultFontSizeEnum) || hasCustomFonts;
|
||||
}
|
||||
}
|
||||
return hasCustomFonts;
|
||||
}
|
||||
@@ -313,14 +316,18 @@ bool RimGridView::applyFontSize(RiaDefines::FontSettingType fontSettingType,
|
||||
bool anyChange = Rim3dView::applyFontSize(fontSettingType, oldFontSize, fontSize, forceChange);
|
||||
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
|
||||
{
|
||||
auto annotations = annotationCollection();
|
||||
RiaFontCache::FontSize oldFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
|
||||
RiaFontCache::FontSize newFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(fontSize);
|
||||
bool applyFontSizes = forceChange || !annotations->hasTextAnnotationsWithCustomFontSize(oldFontSizeEnum);
|
||||
|
||||
if (applyFontSizes)
|
||||
auto annotations = annotationCollection();
|
||||
if (annotations)
|
||||
{
|
||||
anyChange = annotations->applyFontSizeToAllTextAnnotations(oldFontSizeEnum, newFontSizeEnum, forceChange) || anyChange;
|
||||
RiaFontCache::FontSize oldFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
|
||||
RiaFontCache::FontSize newFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(fontSize);
|
||||
bool applyFontSizes = forceChange || !annotations->hasTextAnnotationsWithCustomFontSize(oldFontSizeEnum);
|
||||
|
||||
if (applyFontSizes)
|
||||
{
|
||||
anyChange =
|
||||
annotations->applyFontSizeToAllTextAnnotations(oldFontSizeEnum, newFontSizeEnum, forceChange) || anyChange;
|
||||
}
|
||||
}
|
||||
}
|
||||
return anyChange;
|
||||
|
||||
Reference in New Issue
Block a user