mirror of https://git.48k.eu/ogcp
Create servers list if do not exists
Otherwise, if the configuration file do not have 'SERVERS' array, ogCP crashes trying to append a new server.async-tree
parent
178f253092
commit
328ead9168
|
@ -1507,7 +1507,11 @@ def save_server(form):
|
|||
with open(filename, 'r+') as file:
|
||||
config = json.load(file)
|
||||
|
||||
config['SERVERS'].append(server_dict)
|
||||
try:
|
||||
config['SERVERS'].append(server_dict)
|
||||
except KeyError:
|
||||
config['SERVERS'] = list()
|
||||
config['SERVERS'].append(server_dict)
|
||||
|
||||
file.seek(0)
|
||||
json.dump(config, file, indent='\t')
|
||||
|
|
Loading…
Reference in New Issue