summaryrefslogtreecommitdiff
path: root/filter
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 /filter
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 'filter')
-rw-r--r--filter/source/svg/svgwriter.hxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index 0b6048e7fb18..b4fe4ae06b5f 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -186,9 +186,12 @@ private:
}
void ImplReleaseContext()
{
- delete maContextStack.top();
- maContextStack.pop();
- mpContext = maContextStack.top();
+ if (!maContextStack.empty())
+ {
+ delete maContextStack.top();
+ maContextStack.pop();
+ }
+ mpContext = (maContextStack.empty() ? NULL : maContextStack.top());
}
long ImplMap( sal_Int32 nVal ) const;