summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell/datastream.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-12-17 14:21:07 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-12-18 10:13:28 -0500
commit49c2c79286344cdbaf30999d2e6262b032db97df (patch)
treed3ee2b89ecfcf2b04c651fa0f2000b67162310dd /sc/source/ui/docshell/datastream.cxx
parent507c0a0fe7ec3087adfee36547ebba16d788ae92 (diff)
Check the parse result and handle an error case.
Change-Id: Ie61f8c274754669a15e12a6f1517dacb7645c752
Diffstat (limited to 'sc/source/ui/docshell/datastream.cxx')
-rw-r--r--sc/source/ui/docshell/datastream.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx
index cde296b6cab8..42858ddaadc8 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -175,9 +175,13 @@ DataStream* DataStream::Set(ScDocShell *pShell, const OUString& rURL, const OUSt
// There can be only one ScAreaLink / DataStream per cell.
// So - if we don't need range (DataStream with mbValuesInLine == false),
// just find a free cell for now.
- sfx2::LinkManager* pLinkManager = pShell->GetDocument()->GetLinkManager();
ScRange aDestArea;
- aDestArea.Parse(rRange, pShell->GetDocument());
+ sal_uInt16 nRes = aDestArea.Parse(rRange, pShell->GetDocument());
+ if ((nRes & SCA_VALID) != SCA_VALID)
+ // Invalid range string.
+ return NULL;
+
+ sfx2::LinkManager* pLinkManager = pShell->GetDocument()->GetLinkManager();
sal_uInt16 nLinkPos = 0;
while (nLinkPos < pLinkManager->GetLinks().size())
{
@@ -207,10 +211,9 @@ DataStream* DataStream::Set(ScDocShell *pShell, const OUString& rURL, const OUSt
++nLinkPos;
}
- sfx2::SvBaseLink *pLink = 0;
- pLink = new DataStream( pShell, rURL, aDestArea, nLimit, rMove, nSettings );
+ DataStream* pLink = new DataStream(pShell, rURL, aDestArea, nLimit, rMove, nSettings);
pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, rURL, NULL, NULL );
- return dynamic_cast<DataStream*>(pLink);
+ return pLink;
}
DataStream::DataStream(ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,