aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/ec/context.py
diff options
context:
space:
mode:
authorJ08nY2020-02-19 16:45:16 +0100
committerJ08nY2020-02-19 16:45:16 +0100
commit9788c9af717a49f5e52d6db85afdcd940bb3578d (patch)
tree308aa803db524802336cbf244ec8e73e7585d638 /pyecsca/ec/context.py
parentdacf1e8950031ed01e5d3da0ad0934a209de0a41 (diff)
downloadpyecsca-9788c9af717a49f5e52d6db85afdcd940bb3578d.tar.gz
pyecsca-9788c9af717a49f5e52d6db85afdcd940bb3578d.tar.zst
pyecsca-9788c9af717a49f5e52d6db85afdcd940bb3578d.zip
Diffstat (limited to 'pyecsca/ec/context.py')
-rw-r--r--pyecsca/ec/context.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pyecsca/ec/context.py b/pyecsca/ec/context.py
index 9b57be6..d01f40e 100644
--- a/pyecsca/ec/context.py
+++ b/pyecsca/ec/context.py
@@ -38,10 +38,10 @@ class Tree(OrderedDict):
if len(path) == 0:
return self
value = self[path[0]]
- if isinstance(value, Tree):
- return value.get_by_key(path[1:])
- elif len(path) == 1:
+ if len(path) == 1:
return value
+ elif isinstance(value, Tree):
+ return value.get_by_key(path[1:])
else:
raise ValueError
@@ -134,7 +134,7 @@ class DefaultContext(Context):
self.current.append(action)
def exit_action(self, action: Action) -> None:
- if self.current[-1] != action:
+ if len(self.current) < 1 or self.current[-1] != action:
raise ValueError
self.current.pop()