summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-09-01 17:09:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-09-01 17:09:30 +0200
commit1a91abb451806bd93a08953c6a1afdb88995705e (patch)
treecce6824186e83986e3b992fee68c382141645ee8 /sc
parent148aea32a34fe816c7f1870bfb4cf361a5e81bf0 (diff)
Avoid invalid premature downcasts
Change-Id: Ifc6d84a63719b141ddc9bd89349d4a605d2b3e00
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 770f4dc64935..696f364a4753 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: