diff options
| author | J08nY | 2020-02-19 16:45:16 +0100 |
|---|---|---|
| committer | J08nY | 2020-02-19 16:45:16 +0100 |
| commit | 9788c9af717a49f5e52d6db85afdcd940bb3578d (patch) | |
| tree | 308aa803db524802336cbf244ec8e73e7585d638 /pyecsca/ec/context.py | |
| parent | dacf1e8950031ed01e5d3da0ad0934a209de0a41 (diff) | |
| download | pyecsca-9788c9af717a49f5e52d6db85afdcd940bb3578d.tar.gz pyecsca-9788c9af717a49f5e52d6db85afdcd940bb3578d.tar.zst pyecsca-9788c9af717a49f5e52d6db85afdcd940bb3578d.zip | |
Diffstat (limited to 'pyecsca/ec/context.py')
| -rw-r--r-- | pyecsca/ec/context.py | 8 |
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() |
