From d86a4fc3e359417ff087c4d602dd4f0970523abd Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Mon, 19 Jul 2010 18:54:52 -0400 Subject: [PATCH] patch by Daniel Blueman for Bug 590079 --- share/extensions/funcplot.py | 12 ++++++++---- 1 file 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) -- 2.30.2