# HG changeset patch # User Andrey Skvortsov # Date 1481124239 -10800 # Node ID 6a27490fed96aeb49743fef11b2a70ecb4cbeaea # Parent c40355f450a5ce576acf809184fe0a0d63951341 don't crash on trying to change IP interface for Beremiz_service using taskbar icon if IP wasn't previously By default IP is not set (None) and service listen only on localhost interface. diff -r c40355f450a5 -r 6a27490fed96 Beremiz_service.py --- a/Beremiz_service.py Wed Dec 07 18:15:04 2016 +0300 +++ b/Beremiz_service.py Wed Dec 07 18:23:59 2016 +0300 @@ -286,7 +286,9 @@ print _("PLC is not started.") def OnTaskBarChangeInterface(self, evt): - dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=self.pyroserver.ip_addr) + ip_addr = self.pyroserver.ip_addr + ip_addr = '' if ip_addr is None else ip_addr + dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=ip_addr) dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), ( lambda x :len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!")) ])