Commit ff274835 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][protocoltemplateeditor] Make resistant to "empty" JSON

Empty as in "{}"
parent 44ea95e7
......@@ -156,11 +156,11 @@ class SetWidget(QWidget):
def load(self, json_data):
"""Load this widget with the content of json_data"""
outputs = json_data["outputs"]
outputs = json_data.get("outputs", {})
row = 0
for name, type_ in json_data["outputs"].items():
for name, type_ in outputs.items():
name_item = QTableWidgetItem(name)
type_item = QTableWidgetItem(type_)
self.outputs_tablewidget.setItem(row, 0, name_item)
......@@ -261,7 +261,7 @@ class ProtocolTemplateEditor(AbstractAssetEditor):
def __load_json(self, json_object):
"""Load the json object passed as parameter"""
for set_ in json_object["sets"]:
for set_ in json_object.get("sets", []):
set_widget = SetWidget(self.dataformat_model)
Supports Markdown
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