# HG changeset patch # User Dirk Olmes # Date 1411601340 -7200 # Node ID 58bfa3d9f5a9c61a49f07c217a55ead52c16a39b # Parent 6a62de088c002405a646345db11f0f8ba2357183 fix initialization in case the connections array has not been initialized diff -r 6a62de088c00 -r 58bfa3d9f5a9 RemoteViewer/Settings.py --- a/RemoteViewer/Settings.py Wed Sep 24 03:51:33 2014 +0200 +++ b/RemoteViewer/Settings.py Thu Sep 25 01:29:00 2014 +0200 @@ -22,11 +22,20 @@ connections = self.config[CONNECTIONS_KEY] if connections is not None: return connections - return [] + else: + return self.__initConnections() + else: + return self.__initConnections() + + def __initConnections(self): + connections = [] + self.config[CONNECTIONS_KEY] = connections + return connections def addConnection(self, connection): + connections = self.__connections() json = connection.toJson() - self.config[CONNECTIONS_KEY].append(json) + connections.append(json) self.persist() def update(self, connection):