summaryrefslogtreecommitdiffstats
path: root/share/extensions/funcplot.py
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2010-07-19 22:54:52 +0000
committerAlvin Penner <penner@vaxxine.com>2010-07-19 22:54:52 +0000
commit8baeec42370b0fe55df280a3cbcc8271d8363850 (patch)
tree3f81429b6a5c0a6f664f58cc17d761783a6b613d /share/extensions/funcplot.py
parentfix build broken by 9620 (diff)
downloadinkscape-8baeec42370b0fe55df280a3cbcc8271d8363850.tar.gz
inkscape-8baeec42370b0fe55df280a3cbcc8271d8363850.zip
patch by Daniel Blueman for Bug 590079
Fixed bugs: - https://launchpad.net/bugs/590079 (bzr r9631)
Diffstat (limited to 'share/extensions/funcplot.py')
-rw-r--r--share/extensions/funcplot.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py
index e5f93d430..126429853 100644
--- a/share/extensions/funcplot.py
+++ b/share/extensions/funcplot.py
@@ -70,10 +70,14 @@ def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, bott
ytop = (bottom+height-yzero)/scaley
# functions specified by the user
- if fx != "":
- f = eval('lambda x: ' + fx.strip('"'))
- if fpx != "":
- fp = eval('lambda x: ' + fpx.strip('"'))
+ try:
+ if fx != "":
+ f = eval('lambda x: ' + fx.strip('"'))
+ if fpx != "":
+ fp = eval('lambda x: ' + fpx.strip('"'))
+ # handle incomplete/invalid function gracefully
+ except SyntaxError:
+ return []
# step is the distance between nodes on x
step = (xend - xstart) / (samples-1)