Commit 30e2686d by devttys0

Updated MathExpression to handle all exceptions.

parent a7de4a1f
...@@ -111,11 +111,13 @@ class MathExpression(object): ...@@ -111,11 +111,13 @@ class MathExpression(object):
def __init__(self, expression): def __init__(self, expression):
self.expression = expression self.expression = expression
self.value = None
if expression:
try: try:
self.value = self.evaluate(self.expression) self.value = self.evaluate(self.expression)
except TypeError: except:
self.value = None pass
def evaluate(self, expr): def evaluate(self, expr):
return self._eval(ast.parse(expr).body[0].value) return self._eval(ast.parse(expr).body[0].value)
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
#>>110 string !TRAILER!!! invalid #>>110 string !TRAILER!!! invalid
>110 string x file name: "%s", >110 string x file name: "%s",
>94 string x file name length: "0x%.8s", >94 string x file name length: "0x%.8s",
>54 string x file size: "0x%.8s", >54 string x file size: "0x%.8s"
>54 string x {jump-to-offset:0x%.8s+110+ >54 string x {jump-to-offset:0x%.8s+110+
>94 string x \b0x%.8s} >94 string x \b0x%.8s}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment