summaryrefslogtreecommitdiff
path: root/sc/source/filter/xcl97/xcl97esc.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-12-07 16:11:57 +0100
committerEike Rathke <erack@redhat.com>2011-12-07 17:27:31 +0100
commitcabf25372cf98869616c3d583eb99fa5f5eb3a8f (patch)
tree477ad848a6c40141f00c84e6bbfc0375c4517cfd /sc/source/filter/xcl97/xcl97esc.cxx
parentd432b00bfa05b1bd1413fb0b9afac19de5c1f60b (diff)
old class Stack pop'ed 0 from empty stack, which std::stack doesn't
Some places in the code assumed that if the stack is empty a null pointer is returned by top() (or old Pop()), this doesn't work anymore with ::std::stack that instead has undefined behavior in that case, so check !stack.empty() first before accessing top. (cherry picked from commit ac40f7d6503533954127e818f2bf009200c1e3f2)
Diffstat (limited to 'sc/source/filter/xcl97/xcl97esc.cxx')
-rw-r--r--sc/source/filter/xcl97/xcl97esc.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index 207a37dfcff9..50b53c2e43b1 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -346,9 +346,17 @@ void XclEscherEx::EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID )
// get next object from stack
DeleteCurrAppData();
- pCurrXclObj = aStack.top().first;
- pCurrAppData = aStack.top().second;
- aStack.pop();
+ if (aStack.empty())
+ {
+ pCurrXclObj = NULL;
+ pCurrAppData = NULL;
+ }
+ else
+ {
+ pCurrXclObj = aStack.top().first;
+ pCurrAppData = aStack.top().second;
+ aStack.pop();
+ }
if( nAdditionalText == 3 )
nAdditionalText = 0;
}