diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-03-06 10:39:27 +0900 |
---|---|---|
committer | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-04-09 14:59:46 +0900 |
commit | 17a5ae0b96fd0517bbf4546f3d20ba3484f5df24 (patch) | |
tree | ffc8b63737c2778af4ece0a4c6dea7a73eb9df0c /scripts | |
parent | 6d6745d65a2597cf22525c5458eccbbdbafcef6e (diff) |
view: tidyup get_data()
Some key might not exist on yaml data.
In such case, it will be error on get_data().
This patch return [] when no data or no key case
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/view.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/view.py b/scripts/view.py index 9486e51..baad0f3 100755 --- a/scripts/view.py +++ b/scripts/view.py @@ -85,11 +85,11 @@ class viewer(base.base): self.file = file def get_data(self, key): - data = self.data[key] - if (data): - return data - else: - return [] + if (key in self.data): + data = self.data[key] + if (data): + return data + return [] #-------------------- # make_one |