From c4fabec6ecbe9e82335920a8dc66c8cdbe18d636 Mon Sep 17 00:00:00 2001 From: Blake-Madden <66873089+Blake-Madden@users.noreply.github.com> Date: Tue, 16 Jul 2024 06:49:46 -0400 Subject: [PATCH] Silence harmless GCC warning --- src/base/reportbuilder.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/base/reportbuilder.cpp b/src/base/reportbuilder.cpp index f2b7c43c..04508d1a 100644 --- a/src/base/reportbuilder.cpp +++ b/src/base/reportbuilder.cpp @@ -4614,20 +4614,30 @@ namespace Wisteria if (origin->IsOk()) { if (origin->IsValueString()) - { loadStringToPosition(origin->GetValueString()); } + { + loadStringToPosition(origin->GetValueString()); + } else if (origin->IsValueNumber()) - { position = origin->GetValueNumber(); } + { + position = origin->GetValueNumber(); + } } else if (positionNode->IsValueString()) - { loadStringToPosition(positionNode->GetValueString()); } + { + loadStringToPosition(positionNode->GetValueString()); + } else if (positionNode->IsValueNumber()) - { position = positionNode->GetValueNumber(); } + { + position = positionNode->GetValueNumber(); + } std::optional doubleStartOffset = positionNode->HasProperty(L"offset") ? - std::optional(positionNode->GetProperty(L"offset")->GetValueNumber()) : - std::nullopt; + std::optional(positionNode->GetProperty(L"offset")->GetValueNumber()) : + std::nullopt; if (position.has_value() && doubleStartOffset.has_value()) - { position.value() += doubleStartOffset.value(); } + { + position = position.value_or(0) + doubleStartOffset.value(); + } return position; }