sc/source/core/tool/reftokenhelper.cxx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
New commits: commit 1a91abb451806bd93a08953c6a1afdb88995705e Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Sep 1 17:09:30 2014 +0200 Avoid invalid premature downcasts Change-Id: Ifc6d84a63719b141ddc9bd89349d4a605d2b3e00 diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index 770f4dc..696f364 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -76,11 +76,11 @@ void ScRefTokenHelper::compileRangeRepresentation( break; } - const ScToken* pT = static_cast<const ScToken*>(p); - switch (pT->GetType()) + switch (p->GetType()) { case svSingleRef: { + const ScToken* pT = static_cast<const ScToken*>(p); const ScSingleRefData& rRef = pT->GetSingleRef(); if (!rRef.Valid()) bFailure = true; @@ -90,6 +90,7 @@ void ScRefTokenHelper::compileRangeRepresentation( break; case svDoubleRef: { + const ScToken* pT = static_cast<const ScToken*>(p); const ScComplexRefData& rRef = pT->GetDoubleRef(); if (!rRef.Valid()) bFailure = true; @@ -98,15 +99,21 @@ void ScRefTokenHelper::compileRangeRepresentation( } break; case svExternalSingleRef: - if (!pT->GetSingleRef().ValidExternal()) - bFailure = true; + { + const ScToken* pT = static_cast<const ScToken*>(p); + if (!pT->GetSingleRef().ValidExternal()) + bFailure = true; + } break; case svExternalDoubleRef: - if (!pT->GetDoubleRef().ValidExternal()) - bFailure = true; + { + const ScToken* pT = static_cast<const ScToken*>(p); + if (!pT->GetDoubleRef().ValidExternal()) + bFailure = true; + } break; case svString: - if (pT->GetString().isEmpty()) + if (p->GetString().isEmpty()) bFailure = true; break; default: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits