From cd8c690655314c69295bdd2f44f406d26b798697 Mon Sep 17 00:00:00 2001 From: Gunnsteinn Hall Date: Fri, 5 Jun 2020 12:44:02 +0000 Subject: [PATCH] Add nil checks to prevent crash UO-26 (#397) --- document/paragraphproperties.go | 2 +- document/runproperties.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/document/paragraphproperties.go b/document/paragraphproperties.go index 8c46b361..c9f8f6b0 100644 --- a/document/paragraphproperties.go +++ b/document/paragraphproperties.go @@ -370,7 +370,7 @@ func (p ParagraphProperties) Underline() wml.ST_Underline { func (p ParagraphProperties) UnderlineColor() string { if underline := p.x.RPr.U; underline != nil { color := underline.ColorAttr - if color.ST_HexColorRGB != nil { + if color != nil && color.ST_HexColorRGB != nil { return *color.ST_HexColorRGB } } diff --git a/document/runproperties.go b/document/runproperties.go index c8f3c5c8..5cf2e80f 100644 --- a/document/runproperties.go +++ b/document/runproperties.go @@ -415,7 +415,7 @@ func (r RunProperties) Underline() wml.ST_Underline { func (r RunProperties) UnderlineColor() string { if underline := r.x.U; underline != nil { color := underline.ColorAttr - if color.ST_HexColorRGB != nil { + if color != nil && color.ST_HexColorRGB != nil { return *color.ST_HexColorRGB } }